0

In my java program I use java nio to communicate with another process, and my code doesn't allocate any direct ByteBuffer. My code use an open source lib to communicate with another process with unix domain socket: https://github.com/jnr/jnr-unixsocket and I use some jvm paramter to limit the memory size:

-Djdk.nio.maxCachedBufferSize=262144 -Xms80m -Xmx80m -Xmn40m -Xss256k -XX:NativeMemoryTracking=detail -XX:+UnlockDiagnosticVMOptions -XX:+PrintNMTStatistics -XX:MetaspaceSize=40m -XX:MaxMetaspaceSize=40m -XX:MaxDirectMemorySize=10m -XX:SurvivorRatio=2 -XX:TargetSurvivorRatio=90 -XX:+UseConcMarkSweepGC -XX:ParallelGCThreads=8 -XX:MaxTenuringThreshold=15 -XX:+PrintTenuringDistribution -XX:+UseParNewGC -XX:CMSFullGCsBeforeCompaction=5 -XX:+UseCMSCompactAtFullCollection -XX:+CMSPermGenSweepingEnabled -XX:CMSInitiatingOccupancyFraction=50 -XX:+CMSClassUnloadingEnabled -XX:+DisableExplicitGC -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps

how after several hours, the size of java process grows to more than 400MB enter image description here

and I use jcmd to check the memory of the process enter image description here

the total is about 200MB, so why the physical memory consumed by the java prcocess grow to a size much bigger than jcmd output?

I use java 8.

Y.L.
  • 1,274
  • 6
  • 23
  • 39
  • There's a difference between the max size of the Heap (400 MBs) and the Heap used by the JVM (200 MBs). – Luiggi Mendoza May 10 '18 at 15:59
  • 1
    Pretty much a duplicate: https://stackoverflow.com/q/39684464/1531971 (among many others) Basically, jcmd and other Java specific tools do not (and in most cases, _can not_) take into consideration various OS details related to process resources. –  May 10 '18 at 16:00

0 Answers0