Skip to content

Questions regarding freeing resources reserved by MarshalInterface.FromManaged() #1191

Answered by manodasanW
mqudsi asked this question in Q&A
Discussion options

You must be logged in to vote

@mqudsi When you call FromManaged on a C# implemented object, a CCW is created for it (if none exists) for which the pointer is returned and the reference count on the CCW is incremented. This pointer which is returned is basically the ABI representation of the object and also owns the reference count. If you want to release the reference, you can make use of DisposeAbi as you mentioned or if you passed that pointer to the native side, the native side can call Release on the IUnknown interface just like any other COM object.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by mqudsi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants