Are ratios between spaces/generations in the Java Heap constant?

PermGen vs Young generation ratio is partially maintained by JVM, but to say if ratio is maintained, the answer is No.

JVM7 has become sufficiently advanced and complicated where we shouldn't predict the allocation of generations inside heap.

In every GC cycle that JVM runs, it also does metric analysis to learn of current applications in-memory storage behavior. - If more objects are surviving the multiple cycles of GC, then PermGen is reduced and some of the space is allocated to YoungGeneration. Basically No. of objects x number of GC cycles they skip plays a criteria in dynamically adjusting the generation ratio.

I hope it helps, thanks.


I think you are referring to GC Ergonomics and the Adaptive Size Policy

  • a feature of the Hotspost GC that automatically adapts the sizes of the generations at runtime based on the current allocation behavior of the running application.
  • This feature is ON by default and controls/adapts the size of the generations at runtime.
  • in fact, some of the GC parameters will be ignored if you do not disable Adaptive Size policy, eg. -XX:SurvivorRatio=.

You can disable the Adaptive Size Policy by using the -XX:-UseAdaptiveSizePolicy. Once you disabled the AdaptiveSizePolicy, the GC will respect the initial size of the generations as specified by your startup parameters (e.g. -Xms, -Xmx, -XX:MaxNewSize=,-XX:NewSize=, -XX:SurvivorRatio=) and they will remain constant.

You can find more on Adaptive Size policy in UseAdaptiveSizePolicy and other jvm opts.