sqlnewbie
sqlnewbie

Reputation: 867

How memory is managed for C# objects when C++ code uses as C# class?

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

Answers (2)

Yaur
Yaur

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

SLaks
SLaks

Reputation: 887225

Managed C++ uses the ordinary garbage collector.

Upvotes: 0

Related Questions