1

Running my app in a container (adoptopenjdk11.0.13:debian) with 1g memory limit and maxrampercentage of 50

NMT reports shows this:

Total: reserved=17180391287KB, committed=817523KB
                 Java Heap (reserved=17179869184KB, committed=557056KB)
                            (mmap: reserved=17179869184KB, committed=557056KB)

'cat /sys/fs/cgroup/memory/memory.limit_in_bytes' shows 104857600 as expected

How exactly does JVM calculate available memory if not by looking at cgroups limits?

bruto
  • 467
  • 1
  • 4
  • 13
  • 2
    Are you using ZGC? It's purposely reserves a huge amount of address space in order to use extra bits in the pointers ([colored pointers](https://stackoverflow.com/questions/62926652/the-java-zgc-garbage-collector-uses-a-lot-of-memory/62934057#62934057)). It's OK to have that much "reserved" memory. The reservation of address space costs nothing. – apangin Dec 21 '21 at 09:32
  • @apangin Indeed, ZGC is the difference - the numbers are back to normal with G1 thanks for clearing this up – bruto Dec 21 '21 at 15:29

0 Answers0