I'm working with a client who has an application that uses a large number of COM objects which are unmanaged. The specific COM interface that is used is provided by a third-party so its code cannot be modified. This application is occasionally running into "Out of Memory" errors. In the application, the COM objects are instantiated but are never "cleaned up" to release the memory that they use - since a lot of this is done in loops to perform various tasks multiple times I believe that this is what is eating up the memory.
To alleviate the issue I would like to create a set of sub-classes that inherit from both the COM class and IDisposable so that I can implement the Dispose method to free the memory. This would also enable us to us the "Using" syntax to automatically dispose of objects as they pass out of scope. However, I'm having a hard time finding any documentation that specifically identifies what needs to happen in Dispose to clear the object from memory. Can anyone provide me with some sample C# code for this?
Thanks!
-Dell
DecisionFirst Technologies - Six-time SAP BusinessObjects Solution Partner of the Year
To alleviate the issue I would like to create a set of sub-classes that inherit from both the COM class and IDisposable so that I can implement the Dispose method to free the memory. This would also enable us to us the "Using" syntax to automatically dispose of objects as they pass out of scope. However, I'm having a hard time finding any documentation that specifically identifies what needs to happen in Dispose to clear the object from memory. Can anyone provide me with some sample C# code for this?
Thanks!
-Dell
DecisionFirst Technologies - Six-time SAP BusinessObjects Solution Partner of the Year