Freeing Memory C# Help

With .NET, memory is released by the garbage collector. This is completely different with COM. COM  relies on reference counts.

The interface !Unknown, which is the interface that is required to be implemented by every COM object,offers three methods. Two of these methods are related to reference counts.

The method AddRef ( ) must be called by the client if another interface pointer is needed; this method increments the reference count.
The method Release ( ) decrements the reference count, and if the resulting reference count is 0, the object destroys itself to free memory.

Posted on October 27, 2015 in Interoperability

Share the Story

Back to Top
Share This