I have a Java project that will suddenly freeze at a certain point, calling any interface will time out, and the CPU and memory will be full.
After dumping, I found that the heap memory was abnormal, the Eden Space was used up, the Young GC stopped, and the Full GC continued.
Is there any native and quick way to quickly locate which part of the project code causes the memory leak? If so, I look forward to you telling me how to implement it, thank you.
Some information is as follows
$ cat heap
Attaching to process ID 8964, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.73-b02
using thread-local object allocation.
Parallel GC with 23 thread(s)
Heap Configuration:
MinHeapFreeRatio = 0
MaxHeapFreeRatio = 100
MaxHeapSize = 4294967296 (4096.0MB)
NewSize = 1431306240 (1365.0MB)
MaxNewSize = 1431306240 (1365.0MB)
OldSize = 2863661056 (2731.0MB)
NewRatio = 2
SurvivorRatio = 8
MetaspaceSize = 21807104 (20.796875MB)
CompressedClassSpaceSize = 1073741824 (1024.0MB)
MaxMetaspaceSize = 17592186044415 MB
G1HeapRegionSize = 0 (0.0MB)
Heap Usage:
PS Young Generation
Eden Space:
capacity = 477102080 (455.0MB)
used = 477102072 (454.99999237060547MB)
free = 8 (7.62939453125E-6MB)
99.99999832321% used
From Space:
capacity = 477102080 (455.0MB)
used = 0 (0.0MB)
free = 477102080 (455.0MB)
0.0% used
To Space:
capacity = 477102080 (455.0MB)
used = 0 (0.0MB)
free = 477102080 (455.0MB)
0.0% used
PS Old Generation
capacity = 2863661056 (2731.0MB)
used = 2796622992 (2667.0675201416016MB)
free = 67038064 (63.93247985839844MB)
97.65900842700847% used
67475 interned Strings occupying 7476456 bytes.