Hi everybody.
I really appreciate all your feedback.
I tested the code suggested:
a) GC.Collect();
GC.WaitForPendingFinalizers();
GC.Collect();
It did help to dispose the Excel objects, but they are not disposed when
expected. They still stay in memory for 3 t o 5 minutes, then are disposed
randomly.
b) Marshal.ReleaseComObject(oXlApp)
It rose the following exception:
An unhandled exception of type
'System.Runtime.InteropServices.InvalidComObjectException' occurred in
CheckReturns.exe
Additional information: COM object that has been separated from its
underlying RCW can not be used.
Do you have any other ideas?
Carlos Lozano
www.caxonline.net
"Joyjit Mukherjee" wrote:
> Hi All,
>
> In my view, instead of fiddling with the GC whose operation is, pretty much
> out of our control. Can we try this: -
>
> Marshal.ReleaseComObject(Yourobject)
>
> The Marshal class has excellent capabilities to work with interop objects,
> specially COM ones.
>
> Let me know if I am wrong somewhere.
>
> Thanks
>
> Joyjit
>
>
>
> "Chad Z. Hower aka Kudzu" <(E-Mail Removed)> wrote in message
> news:Xns95FFB0AE3738cpub@127.0.0.1...
> > "sadhu" <(E-Mail Removed)> wrote in news:1108533800.835941.41020
> > @f14g2000cwb.googlegroups.com:
> > > It looks like
> > > GC.Collect();
> > > GC.WaitForPendingFinalizers();
> > > GC.Collect();
> >
> > Yes thats it!
> >
> > > Calling Dispose() won't cause the GC to collect that object. The GC
> > > should be intelligent enough to work without setting the variable to
> > > null, IMO.
> >
> > Setting it to null is useful (albeit limited) for objects without Dispose.
> > But really anything worth disposing should have a Dispose implemented...
> >
> >
> > --
> > Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
> > "Programming is an art form that fights back"
> >
> > Make your ASP.NET applications run faster
> > http://www.atozed.com/IntraWeb/
>
>
>