Reputation: 867
How memory is managed for C# objects when C++ code uses as C# class?
NOTE: I am not specific in this question but just wondering how it is done.
Upvotes: 1
Views: 232
Reputation: 7452
It works exactly the same... objects that are not reachable by managed code are eligible for garbage collection so if your unmanaged code is relying on managed resources to continue existing you must hold a reference to it somewhere in the c# side of the app.
edit: this applies to unmanaged c++
Upvotes: 2