This may be usefull for you. and also check the threads in this forum and beginner forum and SCJP forum.
The Best way to predict your future is to create it
Joined: Oct 30, 2001
You very rarely need to call gc(). It is not guaranteed to do anything. The JVM will usually work out when to do gc anyway.
To track the garbage collection of objects, you can use WeakReference objects. You may dedicate a thread to retrieving references from the queue associated with the WeakReferences and processing them accordingly. You may find it useful to subclass WeakReference, to store some additional information associated with the post-GC operation; if you do, be careful not to accidentally hard-reference the original object, or you will prevent it ever being GCd.
Check out also WeakHashMap. I find that useful occasionally.
Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.<br /> <br />#:^P
Joined: Sep 09, 2004
Also be aware of generational garbage collection, and the fact that the JVM implementation detail in this area changes from release to release. This is probably due to the importance in terms of performance.