Hi all,

From what I understand, GC kicks in either:
a) When your app loses focus, or
b) When you get a OutOfMemoryException, it collects and trys the call
again, truly throwing the exception if there's still not enough memory.

Are there any other times (other than calling GC.Collect() directly)
when collection takes place? And if not, if our app never loses focus
(the devices sole purpose is to run our app), would it be sensible (I
know it's frowned upon) for us to call GC.Collect()?

Additionally, the OutOfMemoryException stuff, does ADO.NET do the same?
I ask coz all of our memory troubles are coming from SqlCe, and I'd like
to clean the memory before opening Readers/filling DataTables, etc.

Thanks for reading, and I hope I've made some kind of sense!
-Jon

Re: When does Garbage Collection collect? by Daniel

Daniel
Fri Nov 25 14:55:07 CST 2005

You got one of two right and are missing at least one more. See links to
netcf team blogs from this:
http://www.danielmoth.com/Blog/2005/01/memory-problems-faq.html

Cheers
Daniel
--
http://www.danielmoth.com/Blog/

"Jon Brunson" <JonBrunson@NOSPAMinnovationsoftwareDOTcoPERIODuk> wrote in
message news:OVDwzeR8FHA.2304@TK2MSFTNGP10.phx.gbl...
> Hi all,
>
> From what I understand, GC kicks in either:
> a) When your app loses focus, or
> b) When you get a OutOfMemoryException, it collects and trys the call
> again, truly throwing the exception if there's still not enough memory.
>
> Are there any other times (other than calling GC.Collect() directly) when
> collection takes place? And if not, if our app never loses focus (the
> devices sole purpose is to run our app), would it be sensible (I know it's
> frowned upon) for us to call GC.Collect()?
>
> Additionally, the OutOfMemoryException stuff, does ADO.NET do the same? I
> ask coz all of our memory troubles are coming from SqlCe, and I'd like to
> clean the memory before opening Readers/filling DataTables, etc.
>
> Thanks for reading, and I hope I've made some kind of sense!
> -Jon