javagarbage-collectionjstat

jstat : Survivor and Eden Space capacity decrease over a period


Does anytime java(8) memory capacity decrease until JVM restart?

I am using jstat -gc to dump memory information and here is the snapshot from two days. The second snapshot has less captaity for SC1 and EC compared to the first snapshot.

Can someone help/explain why I am seeing this behavior? is that expected?

Java version : java-1.8.0-openjdk-1.8.0.191.b12

sc1: survivor space 1 capacity  
EC: eden space capacity 

S0C,    S1C,  S0U,  S1U,EC,EU,OC,OU,MC,MU,CCSC,CCSU,YGC,YGCT,FGC,FGCT,GCT
4096.0,7168.0,3968.3,0.0,123904.0,54705.9,101888.0,24165.6,62464.0,60100.6,7168.0,6618.4,30,1.314,3,0.298,1.612  
5632.0,4096.0,0.0,4000.2,113152.0,56035.3,101888.0,24165.6,62720.0,60145.3,7168.0,6620.0,33,1.345,3,0.298,1.643

Solution

  • There is a flag that controls that: -XX:+UseAdaptiveSizePolicy, which is enabled by default. What this flag does, based on the target pause time you have (you are using G1 I assume), is increase or decrease certain regions based on the heuristics it gathers. The best way to learn at what exactly it does is the source code of G1 itself.