Non heap memory and No of loaded classes keeps on

2019-09-20 18:47发布

问题:

We are doing a performance test of our application. During the test, we find that non heap memory and total no of loaded classes keeps on increasing over the time.

Our guess is probably some 3rd party jar or application code is leaking.

What are the best ways to find such leak or pin point the problem ? Any tools which can help me to find the rootcause ?

We are using Jboss EAP 6.1.

回答1:

Make first Heap Dump by jvisualVm from JDK and analyze it with Memory Analyzer (MAT).

And then see in this direction at header 'Non-Heap': http://www.yourkit.com/



回答2:

It sounds to me like something in your code could be continually creating new dynamic proxy classes. I think that that would give you a leak with the characteristics that you describe.

Other Q&A's explain general techniques for tracking down Java storage leaks; e.g.

  • How to find a Java Memory Leak
  • Tracking down a memory leak / garbage-collection issue in Java

I suggest you start by trying to identify the Class objects. I suspect that you will find that the off-heap memory allocations are associated with them; e.g. associated native code segments produced by the JIT compiler.



回答3:

The JVM ships with a couple of tools that let you look at the contents of the heap ( jhat and jmap ). Using these may allow you to see why you are seeing more than the expected number of loaded classes.

I'd start there before trying to see the non-heap memory usage.