Why does the JVM Native Memory Tracking Report report such high usage of arena area memory in threads

I had a problem when I have a Java application that is sometimes killed by the oom killer on Linux after it runs out of memory. I controlled a bunch and it does not grow. In fact, he does not even reach the maximum allowed through Xmxwhich he was 768MB.

So I turned on tracking my own memory through -XX:NativeMemoryTracking=summary. Then I launched the application, took the basic level and waited for the moment when it started to eat memory, after which I used jcmd <pid> VM.native_memory detail.diffto create the next 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)

The report shows that the amount of memory used has increased significantly committed=15330936KB +14896985KB, but this is not on the heap.

, , . , 1024KB, 47288KB 47 .

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) 

, , +16777692. ? ? , ( stackoverflow), , .

, Arena . , , ?

JDK JDK-8164293, , JVM, ?

+4
2

, . javaw- java 8

.

1) . , java-. , JNI java api. JNI , malloc deleteLocalRef deleteGlobalRef Java-.

2) , java. , , jni.h . java8.

3) , , Jemalloc, , . , Linux.

: https://gdstechnology.blog.gov.uk/2015/12/11/using-jemalloc-to-get-to-the-bottom-of-a-memory-leak/

4) , VADump, , DLL .

, , - . .

+1

- " " 2 ^ 63/2 ^ 64. , - , , , .

0

Source: https://habr.com/ru/post/1688172/


All Articles