Incorrect Memory Usage Reported When Using ZGC + sun.misc.Unsafe

Alex Elent alex at
Fri Jan 4 01:22:14 UTC 2019


Looking for some help on an issue we are experiencing exclusively with ZGC.
I'm unsure if the problem lies with ZGC or the kernel or where. Looking for
your experienced guidance if possible.

We experienced this in our actual application but I managed to create a
simpler reproducible case.

I've attached the example Java file (
I've attached a screenshot of top reporting 108% resident memory used.

This is running on an EC2 t2.medium instance (2 vCPU / 4GB RAM).

I compile with:
javac -cp .

I run with:
java -XX:+UnlockExperimentalVMOptions -XX:+UseZGC -Xms3500M -Xmx3500M -cp .

Thank you so much for your help!

More information about the zgc-dev mailing list