« Home | Lower Case to Uppre Case Conversion » | PRINTING THE NON-PRIMES » | PRIME FACTORS OF ALL NON-PRIMES BELOW 500 » | What is Garbage Collection & Why is Garbage Collec... » | Public static void main (String args[]) » | Delete and Update values in MySql Using Java » | Insert values into table Using Java » | Program to Retrive values from Mysql Using Java » | Java Mysql Connectivity » | Program to Delete Files in a Given Directory » 

Sunday, March 12, 2006 

Algorithms Used in Garbage collection

Post-HotSpot JVM:
The Exact VM (JVM 1.2.2) introduced exact garbage collection. Sun then improved the exact GC design in JVM 1.3 and renamed it generational GC. Java HotSpot VM 1.3.1's GC is fully accurate, guaranteeing that:

1)You can reliably reclaim all inaccessible objects' memory
2)You can relocate all objects to compact memory, eliminating object memory fragmentation

Three types of collection algorithms:
• Copy/scavenge collection
• Mark-compact collection
• Incremental (train) collection

The HotSpot JVM provides three GC algorithms, each tuned for a specific type of collection within a specific generation. The copy collection quickly cleans up short-lived objects in the new generation heap. The mark-compact algorithm employs a slower, more robust technique to collect longer-lived objects in the old generation heap. The incremental algorithm attempts to improve old generation collection by performing robust GC while minimizing pauses.

Copy/scavenge collection:
Using the copy algorithm, the JVM reclaims most objects in the new generation object space simply by making small scavenges . Longer-lived objects are ultimately copied, or tenured, into the old object space.

Mark-compact collection:
As more objects become tenured, the old object space begins to reach maximum occupancy. The mark-compact algorithm, used to collect objects in the old object space, has different requirements than the copy collection algorithm used in the new object space.

The mark-compact algorithm first scans all objects, marking all reachable objects. It then compacts all remaining gaps of dead objects. The mark-compact algorithm occupies more time than the copy collection algorithm; however, it requires less memory and eliminates memory fragmentation.

Incremental (train) collection:
The new generations copy/scavenge and the old generation mark-compact algorithms can't eliminate all JVM pauses. Such pauses are proportional to the number of live objects. To address the need for pause less GC, the Hotspot JVM also offers incremental, or train, collection.

Incremental collection breaks up old object collection pauses into many tiny pauses even with large object areas. Instead of just a new and an old generation, this algorithm has a middle generation comprising many small spaces. There is some overhead associated with incremental collection; you might see as much as a 10-percent speed degradation.

About me

  • I'm phanindra
  • From Hyderabad, Andhra Pradesh, India
  • An Alumini of JNTU Hyd into happening IT industry...
My profile

Visitors
Bloggeries Blog Directory BlogRankings.com singapore blog directory blog search directory
Google
 
Web conceptoftheday.blospot.com