How Garbage Collection Works In Java

Avoid Common Problems With Java Garbage Collection

Most of the time spent tuning garbage collection involves delaying compaction. Since most objects don't live long, garbage collection can be performed on just the young generation for a while, but eventually old dead objects will need to be reclaimed. 

Full garbage collection can be further delayed by keeping track of where old objects have been removed and use the freed memory instead. Still, at some point this space will become fragmented and will need to be reclaimed. Garbage collection can be delayed as long as possible through tuning, but it cannot be delayed forever.

Most garbage collectors must halt application processing to determine which objects are still in use, which can then be collected, followed by defragmentation and compaction of the memory heap. Pause times increase linearly with memory heap size, so a large heap can lead to noticeable delays for users and poor application performance.

There is a way, however, to completely eliminate garbage collection pauses and the need for GC tuning - learn how this can be accomplished by downloading this white paper.

© Azul Systems, Inc. 2017 All rights reserved.