Thursday, October 9, 2008

Memory Shrinking

When in the logs we see that the heap size has come down from the prescribed size of 1GB. Here is a snippet from the log that shows GC timestamps...

3346249.769: [GC [PSYoungGen: 33533K->2573K(31360K)] 115770K->84834K(121472K), 0.0178940 secs]

3346264.904: [GC [PSYoungGen: 31309K->2617K(30336K)] 113570K->85181K(120448K), 0.0392937 secs]

3346268.964: [GC [PSYoungGen: 30329K->3125K(31360K)] 112893K->85750K(121472K), 0.0159574 secs]

3346273.119: [GC [PSYoungGen: 29877K->3381K(30336K)] 112502K->86006K(120448K), 0.0166255 secs]

3346279.315: [GC [PSYoungGen: 29237K->2509K(30528K)] 111862K->85142K(120640K), 0.0416666 secs]

3346285.986: [GC [PSYoungGen: 30477K->2237K(32768K)] 113110K->86029K(122880K), 0.0514837 secs]

3346295.162: [GC [PSYoungGen: 32765K->2333K(37440K)] 116557K->86169K(127552K), 0.0143630 secs]

3346303.684: [GC [PSYoungGen: 35357K->3445K(39936K)] 119193K->87281K(130048K), 0.0211281 secs]

3346314.107: [GC [PSYoungGen: 38965K->3157K(40640K)] 122801K->87061K(130752K), 0.0670872 secs]

3346322.275: [GC [PSYoungGen: 39381K->3389K(43840K)] 123285K->87325K(133952K), 0.0614884 secs]

3346334.052: [GC [PSYoungGen: 42941K->3381K(44864K)] 126877K->87333K(134976K), 0.0332192 secs]

[PSYoungGen: 2426K->0K(40192K)] [PSOldGen: 79638K->72079K(86016K)] 82064K->72079K(126208K) [PSPermGen: 80980K->80980K(131072K)], 3.3801686 secs]

The total size of the heap Shrinks to 126MB?

It is because of the option UseAdaptiveSizePolicy is on by default with the throughput collector (useParallelGC).


It's called GC ergonomics: This GC will look for the minimum footprint and do dynamic heap sizing, independently of what you set as heap size.


That is why your heap is shrinking.

If you don't want that, use -XX:-UseAdaptiveSizePolicy on the command line.

Or even better, specify your own goals as to GC pause time (MaxGCPauseMillis) and application throughput (GCTimeRatio).

Please go though the below link,

http://forums.sun.com/thread.jspa?threadID=5228441

No comments: