__nogc

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;
 
T

Tomas Restrepo \(MVP\)

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).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top