Re: Unnaccounted memory in Java application running in Cloud Foundry


Daniel Mikusa
 

Try running `jcmd <pid> VM.native_memory summary` to get a full summary of
the memory being used by the JVM. Looks like this.

```
$ jcmd 72082 VM.native_memory summary
72082:

Native Memory Tracking:

Total: reserved=3532459KB, committed=271627KB
- Java Heap (reserved=2097152KB, committed=131072KB)
(mmap: reserved=2097152KB, committed=131072KB)

- Class (reserved=1065321KB, committed=18537KB)
(classes #2667)
(malloc=361KB #3182)
(mmap: reserved=1064960KB, committed=18176KB)

- Thread (reserved=30846KB, committed=30846KB)
(thread #31)
(stack: reserved=30720KB, committed=30720KB)
(malloc=91KB #163)
(arena=35KB #60)

- Code (reserved=251209KB, committed=9669KB)
(malloc=1609KB #2458)
(mmap: reserved=249600KB, committed=8060KB)

- GC (reserved=26595KB, committed=20167KB)
(malloc=19727KB #205)
(mmap: reserved=6868KB, committed=440KB)

- Compiler (reserved=141KB, committed=141KB)
(malloc=10KB #97)
(arena=131KB #3)

- Internal (reserved=630KB, committed=630KB)
(malloc=598KB #4186)
(mmap: reserved=32KB, committed=32KB)

- Symbol (reserved=4603KB, committed=4603KB)
(malloc=3124KB #23113)
(arena=1479KB #1)

- Native Memory Tracking (reserved=530KB, committed=530KB)
(malloc=5KB #63)
(tracking overhead=525KB)

- Arena Chunk (reserved=196KB, committed=196KB)
(malloc=196KB)

- Unknown (reserved=55236KB, committed=55236KB)
(mmap: reserved=55236KB, committed=55236KB)
```

Dan

On Mon, May 9, 2016 at 5:54 PM, Lorenzo Jorquera <
lorenzo.jorquera(a)servicemax.com> wrote:

Hello,

I am running a Java application in Cloud Foundry V3. The manifest
indicates 2000Mb of memory. The Java memory parameters (obtained via jcmd)
are as follow:

-XX:CICompilerCount=3 -XX:+HeapDumpOnOutOfMemoryError
-XX:InitialHeapSize=524288000 -XX:MaxHeapSize=641728512
-XX:MaxMetaspaceSize=268435456 -XX:MaxNewSize=213909504
-XX:MetaspaceSize=268435456 -XX:MinHeapDeltaBytes=524288
-XX:NativeMemoryTracking=summary -XX:NewSize=174587904
-XX:OldSize=349700096 -XX:ThreadStackSize=1024
-XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseParallelGC

So, the application has a heap size of ~ 600 Mb and a Metaspace size of ~
256 Mb.

However, if I execute top, I get:

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
34 vcap 0 -20 5756056 1.574g 28632 S 0.3 10.7 3:12.94
java


So for the operating system the process is using nearly 1.6 Gb, while the
Heap and Metaspace are configured to only use 856Mb.

I thought that it was possible that the difference would be in Native
Memory, but the native memory reported usage is also much less than 1.6 Gb:


cap(a)hqcquhb1si9:~$ /home/vcap/app/.java-buildpack/open_jdk_jre/bin/jcmd
34 VM.native_memory
34:

Native Memory Tracking:
Total: reserved=2203649KB, committed=960861KB
- Java Heap (reserved=626688KB, committed=609280KB)
(mmap: reserved=626688KB, committed=609280KB)


So, my doubt is, what are this extra 700Mb?



--
Lorenzo Jorquera

Join cf-dev@lists.cloudfoundry.org to automatically receive all group messages.