Java Garbage Collection Info and Tuning
Carol McDonald, a Java Architect at Sun, has put together a very nice set of slides on the concepts behind garbage collection (GC) in Java, how to tune your application for the best GC performance, and tools to help you further. This was part of a presentation she gave, which I unfortunately was not at.
Her blog entry is here (with lots of links):
Or you can find just the slides at:
Overall, the slides are very good, and cover the basics of what garbage collection is, how Java uses the concept of "generations" to speed up most collections, and how object pooling (a technique people use to "help" the GC) actually make it worse. I suggest you take a look at the slide and read further on the topic. Having the skills to tune the JVM and GC can do wonders for any Java application's performance.
References and More Information
Here are some links from Carol's slides, as well as some of my own.
Inside the G1 Garbage Collector:
Real-time Garbage Collection:
Finding Memory Leaks Using the NetBeans Profiler.Performance, Monitoring and Management, Testing, and Debugging of Java Applications:
Memory management white paper:
Destructors, Finalizers, and Synchronization:
Memory-retention due to finalization article:
Help finding bugs:
Heap analysis tools Monitoring and Management:
Happy coding (and garbage collecting)!