java heap space and tools jvisualvm.exe

Recently met java heap space error.

The reason for this problem, but it is still a heap overflow.

solve this problem

1 First, we consider, in the code where the use of more objects, but there is no timely recovery.

2 we can go see the tool by jvisualvm.exe

 

We first jdk folder bin directory to find jvisualvm.exe. Double-click to run

 

Then we find the java program running, double-click to enter

 

Then follow to select the monitor, cpu / memory heap Dump

 

Then, select the category, sorting according to size, to find the maximum consumption of objects, displayed in the example right-view

 

Here I am looking int [], anyway, a few large objects, to be viewed

 

Found in the figure above type of information, we know image is the main reason

Then the program code, to find the relevant Image, manually set the final Null

Guess you like

Origin www.cnblogs.com/hanjun0612/p/11528933.html