I am having an issue where I have a java application that occasionally gets killed by the oom killer in linux after having run out of memory. I have monitored the heap and it does not grow. In fact, it never even reaches the maximum allowed via Xmx
which was 768MB
.
Therefore I enabled native memory tracking via -XX:NativeMemoryTracking=summary
. I then ran my application, took a baseline and then waited till the point where it started to eat memory, at which point I used jcmd <pid> VM.native_memory detail.diff
to produce the following report.
Native Memory Tracking:
Total: reserved=16894180KB +14703341KB, committed=15330936KB +14896985KB
- Java Heap (reserved=786432KB, committed=450048KB +129536KB)
(mmap: reserved=786432KB, committed=450048KB +129536KB)
- Class (reserved=1185329KB +110708KB, committed=156657KB +128180KB)
(classes #23288 +19829)
(malloc=11825KB +2164KB #27117 +23990)
(mmap: reserved=1173504KB +108544KB, committed=144832KB +126016KB)
- Thread (reserved=16825159KB +16803246KB, committed=16825159KB +16803246KB)
(thread #47 +24)
(stack: reserved=47288KB +25472KB, committed=47288KB +25472KB)
(malloc=153KB +82KB #240 +120)
(arena=16777717KB +16777692 #92 +48)
- Code (reserved=260509KB +9756KB, committed=63625KB +56100KB)
(malloc=10909KB +9756KB #14012 +11850)
(mmap: reserved=249600KB, committed=52716KB +46344KB)
- GC (reserved=39135KB +15KB, committed=37831KB +307KB)
(malloc=10399KB +15KB #629 +478)
(mmap: reserved=28736KB, committed=27432KB +292KB)
- Compiler (reserved=890284KB +890139KB, committed=890284KB +890139KB)
(malloc=55KB +41KB #334 +258)
(arena=890229KB +890098 #8 +5)
- Internal (reserved=13299KB +3377KB, committed=13299KB +3377KB)
(malloc=13267KB +3377KB #26649 +21418)
(mmap: reserved=32KB, committed=32KB)
- Symbol (reserved=32729KB +27117KB, committed=32729KB +27117KB)
(malloc=28565KB +24400KB #285695 +250801)
(arena=4163KB +2717 #1)
- Native Memory Tracking (reserved=13011KB +12136KB, committed=13011KB +12136KB)
(malloc=367KB +241KB #5803 +3803)
(tracking overhead=12644KB +11895KB)
- Arena Chunk (reserved=18014398506330278KB -3153154KB, committed=18014398506330278KB -3153154KB)
(malloc=18014398506330278KB -3153154KB)
From the report I can see that the amount of memory used has increased significantly committed=15330936KB +14896985KB
, but this is not in the heap.
It appears that this has occurred in the memory used by the threads. The stack itself appears normal in that each thread stack should be 1024KB
so 47288KB
would be reasonable for 47 threads.
Thread (reserved=16825159KB +16803246KB, committed=16825159KB +16803246KB)
(thread #47 +24)
(stack: reserved=47288KB +25472KB, committed=47288KB +25472KB)
(malloc=153KB +82KB #240 +120)
(arena=16777717KB +16777692 #92 +48)
In particular, it reports the arena as having increased by +16777692
. What could have caused this and why? Or is this not an issue? From other reports I have seen online (including other stackoverflow questions) the arena memory usage has never been as high as this.
Also, the Arena Chunk itself in terms of the size reserved is massive. Is this normal and if not what could cause this abnormality?
The following open JDK bug JDK-8164293 appears to report a memory leak in the JVM itself, so could I be experiencing this bug?