how to release the memory allocated by 'gcnew'

  • Thread starter Thread starter Vivienne
  • Start date Start date
V

Vivienne

Hi,

I have a question about "gcnew". I am a C# library in my c++ project,
so "gcnew" is often used when calling the managed methods. so here are
my questions:
are new memories allocated by when calling "gcnew", just like the
"new"?
should I delete it when I don't need it, just like what I do to the
momery blocks allocated by "new"?

Thanks!

Vivienne
 
I have a question about "gcnew". I am a C# library in my c++ project,
so "gcnew" is often used when calling the managed methods.

There's a great C++ group for questions like this. Check out
microsoft.public.dotnet.languages.vc

are new memories allocated by when calling "gcnew", just like the
"new"?
Yes


should I delete it when I don't need it, just like what I do to the
momery blocks allocated by "new"?

No, the garbage collector will delete it.


Mattias
 
Thank you very much!

There's a great C++ group for questions like this. Check out
microsoft.public.dotnet.languages.vc


No, the garbage collector will delete it.

Mattias
 

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

Back
Top