Java theory and practice: Garbage collection and performance
Summary and Resources
Garbage collection has come a long way in the last several years. Modern JVMs offer fast allocation and do their job fairly well on their own, with shorter garbage collection pauses than in previous JVMs. Tricks such as object pooling or explicit nulling, which were once considered sensible techniques for improving performance, are no longer necessary or helpful (and may even be harmful) as the cost of allocation and garbage collection has been reduced considerably.
Resources
- Participate in the discussion forum on this article. (You can also click Discuss at the top or bottom of the article to access the forum.)
- Read the complete Java theory and practice series by Brian Goetz.
- The previous two installments of Java theory and practice, "A brief history of garbage collection" and
"Garbage collection in the 1.4.1 JVM," cover some of the basics of garbage collection in Java virtual machines.
- Garbage
Collection: Algorithms for Automatic Dynamic Memory Management
(John Wiley & Sons, 1997) is a comprehensive survey of garbage
collection algorithms, with an extensive bibliography. The author,
Richard Jones, maintains an updated bibliography of nearly 2000 papers
on garbage collection on his Garbage Collection Page.
- The Garbage Collection mailing list maintains a GC FAQ.
- The IBM 1.4 SDK for the Java plaform uses a mark-sweep-compact collector, which supports incremental compaction to reduce pause times.
- The three-part series, Sensible
sanitation by Sam Borman (developerWorks, August 2002), describes the garbage collection strategy employed by the IBM 1.2 and 1.3 SDKs for the Java platform.
- This article from the IBM Systems Journal describes some of the lessons learned building the IBM 1.1.x JDKs, including the details of mark-sweep and mark-sweep-compact garbage collection.
- John Coomes and Tony Printezis of Sun presented a talk at JavaOne 2003 on
Garbage
collection in the HotSpot Virtual Machine.
- In his Performance Myths Exposed talk at JavaOne 2003, Dr. Cliff Click demonstrated that object pooling is a loss with all but the most heavyweight objects.
- The example in Listing 3 was raised by Sun in a 1997 Tech Tip.
- The paper "Removing GC Sychronisation" is a nice survey of potential scalability bottlenecks in garbage collection implementations.
- In the paper "A fast write barrier for generational garbage collectors,"
Urs Hoeltze covers both the classical card-marking algorithm and an
improvement that can reduce the cost of marking significantly by
slightly increasing the cost of scanning dirty cards at collection time.
- "Eye on performance: Referencing objects" (developerWorks,
August 2003) by Jack Shirazi and Kirk Pepperdine offers some insight
into improperly scoped variables and the need for explicit nulling.
- Find hundreds more Java technology resources on the
developerWorks Java technology zone.
- Visit the Developer Bookstore for a comprehensive listing of technical books, including hundreds of Java-related titles.
View Java theory and practice: Garbage collection and performance Discussion
Page: 1 2 3 4 5 6 Next Page: Writing garbage collection-friendly classesFirst published by IBM developerWorks