1. Problems and phenomena
There is a dump file with a size of 14G, which is analyzed by the jhat tool
error out of memory
Reading from gl.hprof... Dump file created Wed Jun 08 17:56:28 CST 2022 Exception in thread "main" java.lang.OutOfMemoryError: Java heap space at java.util.Hashtable.addEntry(Hashtable.java:436) at java.util.Hashtable.put(Hashtable.java:477) at com.sun.tools.hat.internal.model.Snapshot.addHeapObject(Snapshot.java:166) at com.sun.tools.hat.internal.parser.HprofReader.readInstance(HprofReader.java:744) at com.sun.tools.hat.internal.parser.HprofReader.readHeapDump(HprofReader.java:491) at com.sun.tools.hat.internal.parser.HprofReader.read(HprofReader.java:275) at com.sun.tools.hat.internal.parser.Reader.readFile(Reader.java:92) at com.sun.tools.hat.Main.main(Main.java:159) [root@nccztsjb-node-27 data]# netstat -ntlp
I changed a host with 32G memory, and the execution still reported an error of memory overflow. I was thinking about whether the jhat tool itself has a memory limit…
2. Solution
Increase the memory used by jhat
jhat -J-mx20g gl.hprof
Use -J to specify the size of the memory. [-J-mx20g]