I started a java program:
java -cp -Xms6072m -Xmx6072m -Xmn2048m -XX:PermSize=256m -XX:MaxPermSize=256m -XX:-DisableExplicitGC
But there were too many Full GC?
2013-07-09T18:16:42.215+0800: [Full GC [PSYoungGen: 11987K->0K(1972032K)] [PSOldGen: 333076K->150949K(408768K)] 345063K->150949K(2380800K) [PSPermGen: 44430K->44430K(262144K)], 0.4696770 secs] [Times: user=0.47 sys=0.00, real=0.47 secs]
2013-07-09T18:16:58.696+0800: [Full GC [PSYoungGen: 12357K->0K(2029568K)] [PSOldGen: 386748K->118215K(383232K)] 399105K->118215K(2412800K) [PSPermGen: 44430K->44430K(262144K)], 0.5117670 secs] [Times: user=0.51 sys=0.00, real=0.51 secs]
I don't know why! Anybody can help me?
Depending one the Garbage Collector you chose, garbage collections not only happen when the memory is full. They can be triggered by various events/states. Somehow the Garbace Collector thought it was the right moment to start run a garbage collection.
Try to find out the characteristics of the garbage collector you are using. Preventing garbage collections can be very tricky and without any further info it is hard to give any advice. It is rarely the case that garbage collections are the real cause of any problems. Usually garbage collections are just critical in realtime applications. The half second of time it outputs at the end are most likely the time the whole garbage collection took. Usually only a small part of that is the time the application was paused.
I don't know what "too many" means, but I believe the intent of this:
-XX:-DisableExplicitGC
is to disable calls to explicit garbage collection, ie System.gc() or Runtime.getRuntime().gc(). If that was the intent, the minus is wrong, it should be:
-XX:+DisableExplicitGC
According your command line, your heap geometry:
According your GC log, when first Full GC is happening
When JVM start young GC, it has to be sure that it has enough free space in old to accommodate promote object.
Unfortunately, you have not included minor GC record, so I have to speculate further.
JVM sees 1.1 GiB of data in young space and only about 0.7 GiB of free space in old space, so it may have not enough free space in accommodate promoted objects. It may be reason to start full GC.
But why young GC were triggered at this point if there are plenty of free space in eden?
Below are few possible reasons:
Also please note that -XX:-DisableExplicitGC
flag has no effect (minus instead of plus), so all this weird behavior may be caused by System.gc()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.