1. top commands are commonly used.
Shift + m can be sorted by memory usage
Print out a java Process Using a pid) All 'object' in memory, such as the generated objects and their quantity ).
Tools that can output all objects in the memory, or even heap in the VM, can be output in binary to text. Use jmap-histo pid. If you use SHELL jmap-histo pid> a. log, you can save it to the text. After a period of time, you can use the text comparison tool to compare which objects are recycled by GC. Jmap-dump: format = B, file = outfile 3024 can output the heap Memory of the 3024 process to the outfile file, and then use the MAT Memory Analysis Tool ), use see: http://blog.csdn.net/fenglibing/archive/2011/04/02/6298326.aspx) or with jhat (Java Heap Analysis Tool) to visually display problems with the current memory in the form of images.
Use the following method on a 64-bit machine:
Jmap J-d64-heap pid
Displays information about memory usage of java processes.
Jmap pid # print the summary of memory usage
Jmap-heap pid # java heap Information
Jmap-histo: live pid # count, which indicates that
Jmap-histo pid> mem.txt # print simple information about the memory occupied by each object, usually redirected files
JMap-dump: format = B, file = mem. dat pid # output the memory usage details to the mem. dat file.
Other references
Http://docs.oracle.com/javase/7/docs/technotes/samples/hprof.html
This article is from the "seavar" blog, please be sure to keep this source http://4397407.blog.51cto.com/4387407/1287944