Saturday, March 9, 2013

JRockit JVM GC Types




Below mentioned are the types of GCs used by JRockit JVM

Mark and Sweep GC

Marks all reachable objects from Java Threads, native Handles and other root sources. Sweeps all the remaining objects.

Works on entire heap if no Nursery implemented. If nursery is there then YGC will be used for Nursery and M&S will be for Old space.

So YGCs happens more frequently and Old GCs happens less frequently and then Full GCs happens much less frequently.

During sweep, the free slots of memory are identified in order to allocate for new objects

Mark and Sweep can be of multiple types
    (1) Mostly Concurrent Mark ans sweep
    (2) Parallel Mark and Sweep

    In combination - Concurrent Mark and Parallel Sweep, Parallel Mark and concurrent sweep

The above method1 allows most of the time to have Java Threads running (except in the initial marking)
Method2 will be very fast as it uses all CPUs and also stops Threads



Generational GC
If Nursery is implemented then the young GC algorithm called Generational Garbage Collection is used. And, the young GC happens parallel there by stopping the Threads while cleaning up and moving the objects to older space


Dynamic and Static GC:
Dynamic is the default mode of JRockit JVM which is basically an automatic selection of GC strategy to use. We can set the Dynamic mode like 'Throughput', 'Pausetime', 'Deterministic' based on the need and application type

One more interesting concept is the compaction. While sweeping the memory, the old GC algorithm also does compaction similar to defragmentation. This helps in object allocation faster and efficient Heap usage.



No comments:

Post a Comment