Can I know how to deallocate COM server object forcefully from C# .NET if particular condion fails or the object is partially constructed?
The problem is I am using that COM server using DCOM mechanism; in the worst case, when the object is not created fully and I am coming out of application since failure, the COM object is still in memory (showed in COM+ Application component services). If its going beyond some limits, it leads to memory leak and crash. But if its manageable amount of failures, its getting deleted after some point of times.
Sample:- Calculator.App objApp = new Calculator.App();
if( !obj.CanBeUsed() ) { //how to deallocate the COM object objApp }
Note: There is a method GC.Collect() used by Garbase Collector to de-allocate from the heap memory forcefully. Whether I can use this method or .NET franework is giving anyother solution for this particular case?