Please note that it is almost always a terrible idea to force the GC
to collect, especially if you are disposing of your objects correctly.
Please search this newsgroup (and/or related newsgroups) for a full
overview of why this is a bad idea.
According to a Jeffery Richter Geekspeak web-cast I listened to recently,
one of the reasons is that it will effectively reset the GC statistics on
object lifetimes, or rather make them incorrect. The GC maintains
information about object lifetimes in order to more efficiently dispose of
objects depending on how long it expects them to live. Anyway there is
almost never any good reason to force a collect.
The OP should look up the IDisposable pattern (which Richter actually hates,
even though he coded it!).
implements IDisposable '---- press enter after this line and all code wil be
generated for you
now explicitly dispose of anny sub objects in the interface signature
end use your class with the using keyword in the rest of your project
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.