<div dir="ltr"><div dir="ltr"><div>> 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?</div><div><br></div><div>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.</div><div><br></div><div>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.</div><div><br></div><div>In the above case, the JVM is unaware of the 310G container limit or the 305G container usage.</div><div><br></div><div><div dir="ltr" class="gmail_signature"><div dir="ltr">-Man</div></div></div></div></div>