Moving Forward with AHS for G1
Man Cao
manc at google.com
Thu Apr 10 22:15:03 UTC 2025
> If the custom container app allocates 300 GB native memory with, for
example, panama APIs or JNI, what will happen? Is it allowed, or limited?
I suppose the more accurate way to put it is "if an app inside the custom
container environment allocates 300 GB native memory ...". The custom
container environment itself is not a Java app.
If the container memory limit is 310GiB, container usage is 305GiB, and the
app's current Java heap size is 3GiB, and Xmx is 20GiB, then the app could
set CurrentMaxHeapSize=8G (310 - 305 + 3), or CurrentMaxHeapSize=7G (to
give 1GiB head room for growth from other non-heap memory: code cache,
thread stack, metaspace, etc.), to prevent running out of container memory
limit. Note that the app should actively monitor container usage to adjust
CurrentMaxHeapSize, e.g. increasing CurrentMaxHeapSize when container usage
drops. If the app keeps allocating more native memory, CurrentMaxHeapSize
will further drop, and it will eventually die with Java OutOfMemoryError.
In the above case, the JVM is unaware of the 310G container limit or the
305G container usage.
-Man
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/hotspot-gc-dev/attachments/20250410/c090609f/attachment.htm>
More information about the hotspot-gc-dev
mailing list