3 ms·
Using COM from .net absolutely does not prevent leaks. I still don't really understand COM to this day, but I vividly recall spending significant effort and ul
by recursive 6y ago
Using COM from .net absolutely does not prevent leaks. I still don't really understand COM to this day, but I vividly recall spending significant effort and ultimately failing to do Office interop without leaking.
- asveikau 6y agoMy experience using COM with .net is that the GC does not get the hint that there is significant memory that will be released when it drops the COM wrapper object, so a "big" COM object or even many ones will not make the runtime start a collection and it ends up as a leak even though kicking the GC would probably do the right thing. So I would end up wrapping the objects in IDisposable and calling Marshal.ReleaseComObject on Dispose. Then COM objects were usually wrapped in using() to remain idiomatic for manual cleanup in c#. That was some years ago.