When does Garbage Collection collect?

  • Thread starter Thread starter Jon Brunson
  • Start date Start date
J

Jon Brunson

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top