Using Java Native Memory

Is there any tool to find out how much built-in memory was used from my java application? I tested outofmemory from my application: Current setting: -Xmx900m

Computer, Windows 2003 Server 32 bit, 4 GB RAM.

Boot.ini also changes to / 3GB on windows, will there be a difference? If Xmx900m is installed, how much maximum memory can be allocated for this process? is it 1100 m?

+4
source share
6 answers

(in my case, I am using java 8)

add to the command line: -XX:NativeMemoryTracking=summary

then run jcmd <PID> VM.native_memory

You should get something like this:

 Total: reserved=3863657KB, committed=1679977KB - Java Heap (reserved=1843200KB, committed=824320KB) (mmap: reserved=1843200KB, committed=824320KB) - Class (reserved=1311974KB, committed=298726KB) (classes #52579) (malloc=5350KB #76340) (mmap: reserved=1306624KB, committed=293376KB) - Thread (reserved=263278KB, committed=263278KB) (thread #256) (stack: reserved=262140KB, committed=262140KB) (malloc=839KB #1280) (arena=299KB #510) - Code (reserved=278521KB, committed=164773KB) (malloc=28921KB #37983) (mmap: reserved=249600KB, committed=135852KB) - GC (reserved=114897KB, committed=77093KB) (malloc=13729KB #67925) (mmap: reserved=101168KB, committed=63364KB) - Compiler (reserved=461KB, committed=461KB) (malloc=330KB #1138) (arena=131KB #3) - Internal (reserved=13877KB, committed=13877KB) (malloc=13845KB #72978) (mmap: reserved=32KB, committed=32KB) - Symbol (reserved=28871KB, committed=28871KB) (malloc=24740KB #275452) (arena=4131KB #1) - Native Memory Tracking (reserved=8393KB, committed=8393KB) (malloc=45KB #523) (tracking overhead=8348KB) - Arena Chunk (reserved=184KB, committed=184KB) (malloc=184KB) 

See https://docs.oracle.com/javase/8/docs/technotes/guides/troubleshoot/tooldescr007.html for details

+10
source

This article provides good information about troubleshooting internal memory problems and explains how you ran out of memory.

+3
source

For those who come after this, VMMap will give you your answer. It will display its own memory allocation. In my experience, -Xss is ignored at a minimum level of 124K, which I assume is in the OS distribution blocks. OS distribution takes place in all doubling of pieces until it reaches 1 GB (and then everything is ready). If you cannot reduce your threads, try decreasing the maximum heap and max settings, or try the / 3GB switch.

+1
source

The free space of the process is slightly less than 2 GB - Xmx. (assuming Sun JVM). You have to add your permentome space to Xmx and then subtract about 150-200 MB or so for the OS kernel material. If the real problem is a real lack of memory, a 3GB switch or a reduction in Xmx and PermGen space should ease it. Sometimes, at least on Windows, the OS just takes longer than the JVM is ready to wait to allocate a stream, and the problem is that you spam stream is not working, than the memory ends. You should have room for several thousand threads. How much do you have before he surrenders?

There is also a -Xss switch to control the size of the large stack that the JVM requests. YMMV, if changed, actually does something on Windows or not.

0
source

Private memory is the area that the JVM typically uses for internal operations and for executing JNI codes. The JVM uses its own memory to optimize code and to load classes and libraries along with intermediate code generation. The size of the main memory depends on the architecture of the operating system and the amount of memory that is already included in the Java heap. Private memory is a process area where JNI codes are loaded or JVM libraries are loaded, or native performance packages are loaded, and Proxy modules are loaded. There is no JVM option for the size of the Home Region. but we can calculate it approximately using the following formula:

NativeMemory = (ProcessSize - MaxHeapSize - MaxPermSize)

Found it on devopsconsole

0
source

If you use, for example, jvisualvm (it comes with jdk), you can see how much memory your application uses, you can also profile it in more detail.

-1
source

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


All Articles