COM Interop and .NET

Sometimes, you still have to use COM objects from your .NET 2.0 code (groan). However, when you do this, its usually not a bad idea to remember the System.Runtime.InteropServices.Marshal class. The Marshal class has a method on it called ReleaseComObject(object), that can aid greatly in reducing memory usage running rampant.

I’ve added this call and my private byte usage in the application has gone from an exponential line to a pretty much flat line.