简体   繁体   中英

Memory not cleared in 2 consecutive full GC cycles

Not able to understand what garbage collector is doing here , I can see 3 full GC cycles only first Cycle has cleared some memory ,other 2 cycles memory is not cleared still it has taken 16 secs in each cycle.

1189.994: [GC1189.994: [ParNew: 446787K->22515K(471872K), 0.1136668 secs] 1408852K->990343K(4141888K), 0.1144236 secs] [Times: user=0.87 sys=0.01, real=0.11 secs] 
1204.825: [Full GC1204.826: [CMS: 967828K->695710K(3670016K), 20.8721088 secs] 1192388K->695710K(4141888K), [CMS Perm : 133862K->133237K(524288K)], 20.8732268 secs] [Times: user=20.81 sys=0.13, real=20.87 secs] 
1225.703: [Full GC1225.703: [CMS: 695710K->695710K(3670016K), 16.7364748 secs] 695716K->695710K(4141888K), [CMS Perm : 133237K->133237K(524288K)], 16.7373018 secs] [Times: user=16.77 sys=0.01, real=16.74 secs] 
1242.444: [Full GC1242.444: [CMS: 695710K->695710K(3670016K), 16.4691631 secs] 695727K->695710K(4141888K), [CMS Perm : 133237K->133237K(524288K)], 16.4698573 secs] [Times: user=16.51 sys=0.02, real=16.47 secs] 
1283.740: [GC1283.741: [ParNew: 419456K->33117K(471872K), 0.1520895 secs] 1115166K->728827K(4141888K), 0.1531085 secs] [Times: user=1.06 sys=0.01, real=0.15 secs]

Daily i see this in gc.log and , and everytime 2 cycles of no use.

vm parameters are

java -server -Xms4096m -Xmx4096m -XX:PermSize=512m
-XX:MaxPermSize=512m -XX:MaxNewSize=512m -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -XX:+UseMembar -d64 -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -Xloggc:GC.log -classpath ......

Available processors (Cores): 16

Edit: I thought of removing MaxNewSize parameter , as it is 1/8 part of total heap now. And I read in several articles it should be 1/3 to 1/4 of total heap. But i dint get proper explanation how young generation size (MaxNewSize ) will affect GC.

It sounds like the objects are still active and still have links to them. You may be able to fix this by moving around where you declare and initialize your objects/variables. This is not always possible as it may effect the running of the program. Keep in mind Garbage collection does not always free up space it only frees up space that can be freed up.

Is there a reason you think space should be freed up? Are you manually triggering the Garbage collector or is this simply the automated run of it?

Looking in the GC logs, few things comes to my mind

  1. In this case , the old ten is not full 695 MB out of more than 3 GB. So why does GC triggers? Few GC cycle runs but does not collects anything from perm or either old gen. Could it due to manual trigger? Remember full GC runs when old gen heap is having fragmentation ( so promotion is difficult ) or InitiatingHeapOccupancyPercent is set to too low. Default is 45 for some JVM. You can set this to -XX:+InitiatingHeapOccupancyPercent=70

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM