카테고리 없음
Finding Memory Leaks in Java
BenzhaminKim
2020. 7. 21. 11:33
In this post, I'm going to talk about how to find memory leaks in Java.
1. Situation
I've found memory leaks problems from the the socket server. Every 3months, it occurs memory leaks, and it makes the server stop. So, I made a test environment to test and run it with VisualVM.
I've run the program with HeapDUmpOnOutOfMemoryError.
<JVM arguments>
-Xms2g
-Xmx4g
-XX:+UseG1GC
-XX:+HeapDumpOnOutOfMemoryError
Those are the status when the program is waiting for requests, but it uses Heap Memory even though it doesn't get any requests. This is the first problem I need to fix.
When I send requests to the server, it shows memory leaks which is from byte[]. It uses Heap memory 1.2G and drops.
This is the second memory leaks I'm going to fix.