IBM User Guide for Java V7 on Windows > IBM SDK for Java > The collector and the allocator > How to do heap sizing

Initial and maximum heap sizes


IBM recommends setting initial and maximum heap sizes to be different values. For example...

Setting these values equal delays the start of garbage collection until the heap is full. The GC process takes longer and the heap is more likely to be fragmented and require a heap compaction. Starting with a smaller heap size means when the GC starts up, it will run frequently and efficiently, because the heap is small.

IBM recommends setting the initial heap size to that required by your application.

If the GC cannot find enough garbage, it runs compaction. If the GC finds enough garbage, or if any of the other conditions for heap expansion are met, the GC expands the heap.

An application typically runs until the heap is full. Then, successive garbage collection cycles recover garbage. When the heap is full of live objects, the GC compacts the heap. If sufficient garbage is still not recovered, the GC expands the heap.

Heap expands with a set of compacted objects in the bottom of the original heap. Compaction is performed with the minimum heap sizes as the heap grows. An application's initial set of objects tends to be the key or root set, so early compaction triggered by a smaller minimum heap size frees the remainder of the heap for more short-lived objects.

When all has settled down, the JVM has the heap at maximum size with all long-lived objects compacted at the bottom of the heap, and the compaction occurred when compaction was in its least expensive phase. Heap expansion is less processing and memory intensive than the cost of collecting and compacting a very large fragmented heap.


Parent: How to do heap sizing

Error 404 - Not Found

Error 404 - Not Found

The document you are looking for may have been removed or re-named. Please contact the web site owner for further assistance.