Garbage Collector don't joke!
-
Hello! I have a C# Windows Form application (VS 2005) which use some COM object. In the end, after Form close, I recieve error message box : HEADER: .NET BradcastEventWindow.2.0.0.0.1.e6fa8e.0:MyApplication.exe - Application error TEXT: The exception unknown software exception (0x00000005) occured in the application at location 0x7d6210ca Click OK to terminate program. I. I have installed WinDbg, but debugging this application is not available. II. I browse internet for look this error and found that it is Garbage Collector error. III. I started VS and attached to MyApplication.exe and didn't sow that location 0x7d6210ca, of cource many modules loaded, but this address was to big. May be it is addres of virtual memory? So, I think that some COM object don't correctly released or some callback come to released object. May be you have some thinks or ideas?
-
Hello! I have a C# Windows Form application (VS 2005) which use some COM object. In the end, after Form close, I recieve error message box : HEADER: .NET BradcastEventWindow.2.0.0.0.1.e6fa8e.0:MyApplication.exe - Application error TEXT: The exception unknown software exception (0x00000005) occured in the application at location 0x7d6210ca Click OK to terminate program. I. I have installed WinDbg, but debugging this application is not available. II. I browse internet for look this error and found that it is Garbage Collector error. III. I started VS and attached to MyApplication.exe and didn't sow that location 0x7d6210ca, of cource many modules loaded, but this address was to big. May be it is addres of virtual memory? So, I think that some COM object don't correctly released or some callback come to released object. May be you have some thinks or ideas?
Did you dispose of the COM object when you were finished with it?
-- Always write code as if the maintenance programmer were an axe murderer who knows where you live. Upcoming FREE developer events: * Glasgow: Agile in the Enterprise Vs. ISVs, Mock Objects, SQL Server CLR Integration, Reporting Services, db4o ... * Reading: SQL Bits My website
-
Did you dispose of the COM object when you were finished with it?
-- Always write code as if the maintenance programmer were an axe murderer who knows where you live. Upcoming FREE developer events: * Glasgow: Agile in the Enterprise Vs. ISVs, Mock Objects, SQL Server CLR Integration, Reporting Services, db4o ... * Reading: SQL Bits My website
-
May be not... Looks like you are right - I call GC.Collect() before return from main() and it is help.
There are better ways to do this other than calling
GC.Collect()
. Ideally, you should wrap the COM object you are using in a wrapper class that implmenets theIDisposable
interface and the Dispose pattern. This wrapper class should have the responsibility of explicitly releasing (freeing) the the COM object when it is disposed.Scott.
—In just two days, tomorrow will be yesterday. [Forum Guidelines] [Articles] [Blog]
-
There are better ways to do this other than calling
GC.Collect()
. Ideally, you should wrap the COM object you are using in a wrapper class that implmenets theIDisposable
interface and the Dispose pattern. This wrapper class should have the responsibility of explicitly releasing (freeing) the the COM object when it is disposed.Scott.
—In just two days, tomorrow will be yesterday. [Forum Guidelines] [Articles] [Blog]
I strongly agree with the IDisposable method of disposal then the GC.Collect() as it may just about bring down the performance a bit more. Thanks for displaying both the methods. :)
Regards, Vaibhav Sharma
-
I strongly agree with the IDisposable method of disposal then the GC.Collect() as it may just about bring down the performance a bit more. Thanks for displaying both the methods. :)
Regards, Vaibhav Sharma