Search code examples
c#.netgarbage-collectionarcgisarcobjects

Releasing Com Objects Doesnt Affect Memory Usage


When I release com objects by Marshall.ReleaseComObject method, memory usage of application doesnt change. Instead of using Marshall.ReleaseComObject, using Garbage Collector (GC.Collect()) can release memory area of com objects but the UI is getting slow down.

So my question is, what is the best method to release com objects?


Solution

  • Best way to do is using ComReleaser or Marshal.ReleaseComObject methods. Calling GC.Collect method too much will cause to slow down of your application. Let GC do its job when needed.