1. export dump file
1.1 obtain PID( Two ways )
You can use the task manager to get
You can also use jconsole Indirect acquisition
-
stay jdk Of bin In the directory jconsole.exe Execution can be
-
If you don’t see the local process 、 There may be a problem with file permissions
solve :
First through local java Code runs :
System.out.println(System.getProperties());
View the propertiesjava.io.tmpdir
=C:\Users%USER%\AppData\Local\Temp
notes : here %USER% Represents the operating system user name for the variable
Enter this directory , See a hsperfdata_%USER% Catalog , Enter this directory
1.2 Use jmap export dump file
- Get into jdk / bin Catalog
jmap -dump:format=b,file=heap.dump <pid>
The current directory will generate heap.dump file
see JVM The number of instances of classes in memory and the amount of memory consumed
- start-up jvisualvm
- Import dump file
- Select file type and file
- Look at the number of examples 、 size 、 Retain ( Check for memory leaks )
- PS Reserved fields need to be configured