G1 garbage collection

java core 2009. 4. 28. 14:52

G1 ( Garbage First garbage collector) will be applied to jdk 1.6 update 14. It's target is to replace CMS gc algorithm that have no compaction. G1 lower latency time In large memory and is more predictable and enable fast allocation with memory. Compared to CMS, there are enhancedments like compacting,  Improved ease-of-use, predictability.
And It will give the merit that decrease the latency at most during gc time than CMS gc algorithm. Though its alogorithm, java application need fast response like web application have good performance.

Still default gc algorithm is parallel collector in jdk 1.6 update 14. After releasing, maybe used belows

Actually G1 is introduced in java one 2008 (http://developers.sun.com/learning/javaoneonline/j1sessn.jsp?sessn=TS-5419&yr=2008&track=javase)

Looking for G1
- It aims Soft real-time scheduling.
- Compaction
 Disadvantages of CMS is compaction of old generation. CMS have no ability to compact thos generation. G1 have battles fragmentation that have no free lists
- Managin GC
Young gen split into regions to manage. Most reclamation (compaction) happens with evacuation pauses
By maintaining "remembered sets" to pick any region to collect
- GC time
Pause times in G1 quite higher than CMS. It means stop-the-world pause times is long and gc overhead.

Comparation between CMS and G1
CMS (Concurrent Mark & Sweep)
Concurrent threads move objects from young gen to old gen, search objects in object tree of old gen, mark dead object and deallocate marked dead objects continuously, not in full gc time.
- G1 Collector
Not devide into generational space, separate the a bunch of memory block, called region.
The objects in the region are managed by "remembered lists" which confirm referenece. 
And there in region, after checking if live objects are live or not, if region is filled up fully, all lived objects tranfered (copying and deallocating)to other regions. By transfering, fragementation problem can be solved.

* GarbageFirst Garbage Collection David Detlefs, Christine Flood, Steve Heller, Tony Printezis Sun Microsystems, Inc. 1 Network Drive, Burlington, MA 01803, USA

'java core' 카테고리의 다른 글

How to get cpu usage in java.  (0) 2009.04.29
How to get hostname in http url in Java  (0) 2009.04.28
G1 garbage collection  (0) 2009.04.28
Implementing equals method of collections classes  (0) 2009.04.27
JavaOne 2008  (0) 2009.04.17
addShutdownHook() of Runtime class  (0) 2009.04.17
Posted by 김용환 '김용환'

댓글을 달아 주세요