__gc or not __gc 
Author Message
 __gc or not __gc

Hello,

Here is my question:

__gc class M {

   String *s2;

      TestClass *ts

Quote:
};

If we declare a class with the __gc attribute, does it make all the
attributes declared within the class (eg: ts) __gc as well by default?

Or do I have to declare them as well with the __gc if I want them to be
garbage collected?

Thanks,

Jos



Mon, 17 Oct 2005 14:08:38 GMT  
 __gc or not __gc

Quote:

>Hello,

>Here is my question:

>__gc class M {

>   String *s2;

>      TestClass *ts

>};

>If we declare a class with the __gc attribute, does it make all the
>attributes declared within the class (eg: ts) __gc as well by default?

No, it does not. However, the System::String type is already __gc and String
pointers are thus __gc by default, which is why you don't need to declare s2
as a __gc pointer.

Quote:
>Or do I have to declare them as well with the __gc if I want them to be
>garbage collected?

Yes, you have to declare the class TestClass __gc.

--
Doug Harrison
Microsoft MVP - Visual C++



Thu, 20 Oct 2005 01:44:49 GMT  
 __gc or not __gc
Clear!
Thanks,
Jos


Quote:

> >Hello,

> >Here is my question:

> >__gc class M {

> >   String *s2;

> >      TestClass *ts

> >};

> >If we declare a class with the __gc attribute, does it make all the
> >attributes declared within the class (eg: ts) __gc as well by default?

> No, it does not. However, the System::String type is already __gc and
String
> pointers are thus __gc by default, which is why you don't need to declare
s2
> as a __gc pointer.

> >Or do I have to declare them as well with the __gc if I want them to be
> >garbage collected?

> Yes, you have to declare the class TestClass __gc.

> --
> Doug Harrison
> Microsoft MVP - Visual C++



Thu, 20 Oct 2005 02:16:04 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Object __gc* to Object __gc* __gc* ?

2. Question about __gc * __gc *

3. GC Not Occurring in MC++ Application

4. Memory cleanup does not occur, even though GC .Collect() is called

5. 'conservative' GC == 'risky' GC

6. ODD __gc problem

7. gc arrays

8. Convert char* to char __gc[]

9. __gc Array Basics

10. How to implement a __gc ** in a __nogc class

11. Compilation error - __gc type cannot be passed by value

12. Nondefining declaration of __gc class

 

 
Powered by phpBB® Forum Software