Does this generate a COM interface that needs to be explicitly released?

  • Thread starter Thread starter Richard.Haggard
  • Start date Start date
R

Richard.Haggard

Guest
I've created a WPF/MVVM/Prism/Unity application that does image capture. The capture code, which is based on the famous WpfCapture sample, appears to be very leaky. Each time it is invoked there are losses in memory and handles that are never recovered. This has prompted me to go through the code and question everything. There are many lines like this:


var enumD = Activator.CreateInstance(Type.GetTypeFromCLSID(SystemDeviceEnum)) as ICreateDevEnum;


Does enumD need to be passed into a Marshall.ReleaseComObject( enumD )? I've googled this
and the results are mixed where some say you absolutely must and others indicate that the GC
will eventually get it.


Richard Lewis Haggard

Continue reading...
 
Back
Top