Memory Release of C# objects used by MC++

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
We have a class written in MC++ that has a data member of a class written in
C#.
When the MC++ goes out of scope, it's destructor is properly called and it's
memory is released. However, the C# class Dispose() never gets called, and
therefore it's memory is never released.
Is this a known issue? Are we doing something wrong? or do we always have
to explicitly call Dispose() on all C# objects embedded in MC++ classes?
Currently this is a major issue since our application need to run 24x7.
Any help will be appreciated. Thanks. Eyal.
 
Eyal said:
Hi,
We have a class written in MC++ that has a data member of a class written
in
C#.
When the MC++ goes out of scope, it's destructor is properly called and
it's
memory is released. However, the C# class Dispose() never gets called, and
therefore it's memory is never released.
Is this a known issue? Are we doing something wrong? or do we always have
to explicitly call Dispose() on all C# objects embedded in MC++ classes?
Currently this is a major issue since our application need to run 24x7.
Any help will be appreciated. Thanks. Eyal.

If you're using VC++ 7.1 (.NET 2003) then you need to explicitly call
IDisposable::Dispose on the object references you hold.

In VC++ 8.0 (2005), the destructor will automatically call Dispose for you.

-cd
 
Back
Top