Stephan van Hulst wrote:Henry, could you elaborate on this a bit? What are these different collectors you talk of? I'm familiar with mark and sweep, but not with the terms you mentioned.
Sure...
A mark and sweep collector does collection in multiple passes. It traverses the heap and mark everything that is reachable; and then in later passes, it compacts the heap. This pass is the sweep part. Objects are moved only to fill gaps left by unreachable objects.
The other type of collector is the copy collector. It does collection by moving everything that is reachable. The heap is cut in half, and objects are moved from half to half during each cycle. What doesn't move is collected.
A generational collector is not really a collector. It is a technique of using multiple collectors. A new object is placed in a "new" heap, where it is managed by a collector. And if it survives too many cycles, it gets promoted to the tenured heap, where it is managed by another collector. With the Sun JVM, the new generation is a copy collector and the tenured generation is a mark and sweep collector.
Other terms....
"Parallel" means that the collector is threaded -- and will use many processors. "Concurrent" means that the collector will run concurrently with the application. If the collector is not concurrent, it will stop-the-world (the application) until it is finished. Of all the JVMs available today, there is only one GC that is both concurrent and parallel; and that is the Azul JVM.
The Sun JVM actually have many collectors. There are quite a few options for both the new and old generational heaps.
Henry