Wednesday, May 21, 2008

Garbage collection in java

Global collections

An example of the output produced when a global collection is triggered is:

"gc type="global" id="6" totalid="6" intervalms="383.226"
compaction movecount="139926" movebytes="9478888"
refs_cleared soft="0" weak="0" phantom="0"
finalization objectsqueued="0"
timesms mark="33.391" sweep="1.760" compact="65.958" total="101.149"
tenured freebytes="1784720" totalbytes="11337472" percent="15"
gc"


Indicates that a garbage collection was triggered on the heap. Type="global" indicates that this was a global collection (mark, sweep, possibly compact). The id attribute gives the occurrence number of this global collection. The totalid indicates the total number of garbage collections (of all types) that have taken place. Currently this is the sum of the number of global collections and the number of scavenger collections. intervalms gives the number of milliseconds since the previous global collection.

Shows the number of objects that were moved during compaction, and the total number of bytes these objects represented. This line appears only if compaction occurred during the collection.

Provides information relating to the number of Java reference objects that were cleared during the collection. In this example, no references were cleared.

Provides information detailing the number of objects containing finalizers that were enqueued for VM finalization during the collection. Note that this is not equal to the number of finalizers that were run during the collection, because finalizers are scheduled by the VM.

Provides information detailing, respectively, times taken for each of the mark, sweep, and compact phases, as well as the total time taken. When compaction was not triggered, the number returned is zero. Note that if the VM being run is not compiled with compaction support, the compact field will not be displayed.

Indicates the status of the tenured area following the collection. If running in generational mode, there will also be a line output, showing the status of the active nursery area too.

ALSO READ
Java collection performance - Chart view
Java development 2.0: Ultra-lightweight Java web services with Gretty
An actor framework for Java concurrency
The Clean Coder



AddThis Social Bookmark Button

1 comment:

javin paul said...

Nice post buddy. I have also blogged my experience as How Garbage Collection works in Java , let me know how do you find it.