__nogc

  • Thread starter Thread starter chris
  • Start date Start date
C

chris

i was wonder when a __nogc varable array is created in the
a managed class is stored in the traditional c++ heap or
in the clr heap still. The reason i ask is because i read
in a book that when you create a array variable in a
managed class it's not garbage collected. so does that
mean it's but on regular heap or is it on clr but the
garbage collector don't mess with it.


Example;

__gc Myclass {

int date __gc[23];

};

Myclass test = __gc new Myclass;
 
Hi Chris,
i was wonder when a __nogc varable array is created in the
a managed class is stored in the traditional c++ heap or
in the clr heap still. The reason i ask is because i read
in a book that when you create a array variable in a
managed class it's not garbage collected. so does that
mean it's but on regular heap or is it on clr but the
garbage collector don't mess with it.


Example;

__gc Myclass {

int date __gc[23];

};

Myclass test = __gc new Myclass;

The code above is invalid. I'm assuming you mean:

__gc class MyClass {

int date __nogc[23];

};

In that case, the __noc array is stored inside the GC heap inside the memory
belonging to the object of type Myclass it is defined in (it is treated as a
value object).
 
Back
Top