COM Interop – Releasing unused COM libraries


Following up with my last post on releasing PInvoked libraries....this time with COM libraries.  There's a more robust way to do this for COM libraries.  After you're done with your COM libraries and you've released all associated resources (Marshal.ReleaseCOMObject()) you can free all COM libraries that are in your process space by PInvoking CoFreeUnusedLibrariessEx

This call will release any dll's whose DllCanUnloadNow() returns true  You can use process explorer from SysInternals to see this in action. 

 

 

Comments (0)

Skip to main content