managed c++ .net i neeed guy's

C

christopher

i was wondering if you make a managed class and make a
variable __nogc is it but on the stack.

__gc class a

{

int a __nogc[34]; is this but on the stack or the heap?



};
 
B

Bruno van Dooren

i have tried to deduce the answer 3 times, but i could not tell you for
sure.
i suggest you write a little test case, and use the watch windows to see
where it is allocated.

my guess is that it is on the unmanaged heap if your array is a member
variable of your gc class, because the object can still exist after the
function that created it has returned (thereby invalidating the variables
that were created on the stack.).

if you allocate the array as a local variable in a method call, i guess it
is allocated on the stack, since it will not be referenced anymore after the
method returns.

anyone please correct me if i am wrong.

kind regards,
Bruno.
 
R

Ronald Laeremans [MSFT]

Always on the GC heap. Laid out inline in the instances of class a.

Ronald
 

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