Hi Jason

yes, calling ReleaseComObject does the job.

however, I'm just concerned to find out why the Garbage Collection doesn't
work in the first example, but does in the second.

Regards
Howard.

-----Original Message-----
From: Jason Bock [mailto:[EMAIL PROTECTED]]
Sent: 20 May 2002 16:39
To: [EMAIL PROTECTED]
Subject: Re: [DOTNET] strange behaviour with Garbage Collector


>does anyone have any ideas on the following:
>
>if I try this:
>
>Excel.ApplicationClass appClass =  new Excel.ApplicationClass();
>appClass = null;
>GC.Collect();
>
>Excel.exe remains open as a Process in Task Manager.

Have you tried this:

Excel.ApplicationClass appClass =  new Excel.ApplicationClass();
//  Use appClass...
Marshal.ReleaseComObject(appClass);
appClass = null;

This will release the COM object reference (at least it should).

Regards,

Jason

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to