Determining "GC" memory area size

Zhengyu Gu zgu at redhat.com
Fri Nov 10 19:05:48 UTC 2017


Hi Glyn,

> 
> Can anyone here tell me how the GC memory area size is determined? If there
> is documentation, so much the better as we'd prefer not to depend on code
> details that might flux arbitrarily.
> 

GC memory is mainly data structures used by GC runtime. It can be varied 
by collector used, size of the Java heap, the number of GC threads and 
etc. and, of course, the application itself.

Some are *fixed* costs, which can be estimated. E.g. two marking bitmaps 
used by G1, each costs 1/64 of heap size (assuming default object 
alignment).

Some are *semi-fixed*, e.g. taskqueue's fixed cost is about 1M for each 
queue on 64-bits VM, but it can overflow. And the number of task queues 
is proportional to the number of GC threads.

Then there are factors from application itself,  such as object mutation 
rate, inter-generation/region references, etc.


I don't see a single formula for estimating GC memory size. If you are 
using G1, the biggest overhead comes from 2 bitmaps (1/32 * heap size).

Thanks,

-Zhengyu





More information about the hotspot-dev mailing list