Profile Image
Ankit Gupta

Confusion about Memory Allocation

The memory allocation in this report is coming to be 20 GB where as the max memory allocated in 12 GB. Also, the graph in the report depicts usage at 20 GB but on left hand side the total (old + young + meta) is ~12-13 GB. I would like to know what is the descripency here.

 

Report URL - https://gceasy.io/my-gc-report.jsp?p=c2hhcmVkLzIwMjIvMDEvMy8tLWdjLjIwMjEtMTItMTZfMjAtNTAtNDYubG9nLjMuY3VycmVudC56aXAtLTEzLTMxLTU=&channel=WEB

  • memoryallocation

  • jvmarguments

  • maximumheapsize

  • g1gcalgorithm

  • younggen

  • oldgensize

Please Sign In or to post your comment or answer

Profile Image

Ram Lakshmanan

Hello Ankit!

 

 Greetings. Happy new year wishes.

 

 Good question. Let me try to clarify it:

 

 Below is the excerpt from your GC log report, it shows the JVM arguments passed to your application:

 

 Here you can see the Maximum heap size (i.e. Young Gen + Old Gen) is set to 12GB. On top of it there is metaspace which is roughly 1.1 GB. So in total your Young Gen + Old Gen + Metaspace is only 13.1 GB

 

 However your concern is: in the report & graph, sum of Young Gen + Old Gen + Metaspace adds up to 20GB. Why there is this disconnect?

 

 

Ankit - you are using G1 GC algorithm. This algorithm dynamically allocates and changes the Young Gen and Old Gen size at runtime to meet it's ergnomics/heuristics goals. So at one point in time it would have allocated it's old gen size to be 11.4GB, but at that point young gen size would have become 0.6GB (because total allocated max heap size can be only 12GB). Similarly at another point in time it's young generation size would have been 8.04GB, but at that point old gen size would have been 4GB only. But at any point in time, never young gen and old gen's allocated size would have been 11.4GB and 8.04GB. Neven they will exceed the 12GB limit.

 

I hope this might have clarified your question. If not please let me know.

 

Note: Here is a video clip which given general high level introduction about young gen, old gen & metaspace and other regions in JVM. It may be of help.

Got something else on mind? Post Your Question

Not the answer you're looking for? Browse other questions tagged
  • memoryallocation

  • jvmarguments

  • maximumheapsize

  • g1gcalgorithm

  • younggen

  • oldgensize