For example, I set -Xmx as 40G. I expect my java processor won't use exceed 40G.
My program is working fine with cms-gc.
But when I change to G1 gc with same memory(even 15% more memory).
It always killed by oom killer.
I found some article like this: Why does my Java process consume more memory than Xmx?
It express:
G1 is especially known for its
excessive appetite for additional memory, so be aware of this.
So I want to know, how to limit the memory that g1 gc used and why g1 use so much additional memory