What are some tools that can analyze off-heap memory usage in Java?

We have a strange memory leak issue where a Java process running on Linux has more and more swap use. So naturally we looked at a bunch of heaps and also used a profiler to monitor it over a period of time. We found that

1) The number of threads is not growing 2) Heap usage is not growing 3) However (VIRT) usage continues to grow (which can be a problem because the system starts to run out of paging space)

There are now many tools out there that can unload the heap or monitor the heap, but not for off-heap memory. Does anyone have any idea?

PS this is a remote server, we don't have access to any GUI.

+2


source to share


4 answers


You might be missing something in your own memory, such as Sockets. Are there many connections and are you closing connections in a finally block?



+1


source


Not the case where 1) the heap space of the process is not changing, but 2) the change in swap usage indicates that some other process in the box might be causing the sudden increase in memory usage?

In other words, I figured out that something like swap use is regulated by the OS - so if the use of the Java heap in Java does not change, but the use of the swap file seems to indicate to me that the problem lies elsewhere, and only this happens, that the OS chooses your Java process to start eating swap space.



Or am I misunderstanding about swap space?

0


source


Are other pieces of JVM memory growing? For example, the pergent space?

Are you using native libraries (JNI)?

0


source


I will try to answer by answering another question. Is it possible that the JVM heap size configuration is larger than the free physical memory? Even if you define the size of the initial heap much less than the maximum heap size and the JVM allocates all of that, it will never put it back in the OS, even if you pick up all the garbage and you have no more allocation. Don't set the max heap to 1.5GB on a 1G RAM server. Make sure the configured maximum heap size "injects" the free RAM you have with other processes, especially if it is a server application. Otherwise, your application will receive many page errors and change all the time.

0


source







All Articles