简体   繁体   中英

Java Memory Leaks Finalizer Your Kit

I have web server which is having memory leaks. There is sudden spike in old gen usage and then latency of server spikes. When I took heap dump and analyzed using your kit it was suggesting Finalizer object taking 100% of memory. But i am not able to understand why the gc usage is high only at some point of time and it does not happen regularly(it happens say once a week).

Also i observed that there is button on your kit "calculate exact retained size" when i use that finalizer object does not show in updated list.

I am attaching screenshot of your kit.

Also if there is a way i can get list of all the classes from where finalizer is coming up in heap dump.

Before pressing calculate retained size

按下之前计算保留尺寸

After pressing calculate retained size:

按下后计算保留尺寸

As per YourKit docs: Class List page:

On opening the view, estimated retained sizes are shown instead of exact sizes, which cannot be immediately calculated. The exact sizes may be obtained by using "Calculate exact retained sizes" balloon above the "Retained Size" column. However, for most classes the estimation is very close to the exact value, so there is almost no need to run exact size calculation.

java.lang.ref.Finalizer is created by objects overriding Object.finalize() method as they have to be collected in the background. Your best bet would be to inspect the heap dump and figure out which class is using finalize() . Ideally don't depend on this method as it's behavior tends to be unpredictable.

If you have a high GC usage only once a week try to get the GC logs or record JVM behaviour with FlightRecorder. Perhaps you get a stop the world full GC cycle only once a week? It's impossible to tell without seeing logs and JVM configuration.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM