Memory Map for Java 通过这个命令来将堆内存转储成快照文件,比如我们说dump文件或headdump文件
1、使用方式
jmap
Usage:
jmap [option]
(to connect to running process)
jmap [option]
(to connect to a core file)
jmap [option] [server_id@]
(to connect to remote debug server)
where
is one of:
to print same info as Solaris pmap
-heap to print java heap summary
-histo[:live] to print histogram of java object heap; if the "live"
suboption is specified, only count live objects
-clstats to print class loader statistics
-finalizerinfo to print information on objects awaiting finalization
-dump: to dump java heap in hprof binary format
dump-options:
live dump only live objects; if not specified,
all objects in the heap are dumped.
format=b binary format
file= dump heap to
Example: jmap -dump:live,format=b,file=heap.bin
-F force. Use with -dump: or -histo
to force a heap dump or histogram when does not
respond. The "live" suboption is not supported
in this mode.
-h | -help to print this help message
-J to pass directly to the runtime system
jmap [option]
-heap #打印堆的统计信息,新生代,老年代等等信息
-histo[:live] #目的是查看当前堆中对象的占比情况,通常用于查看哪个对象占用的内存最多
-clstats #显示Java堆的类加载器统计信息
-finalizerinfo #
-dump: #生成堆的dump文件
format=b #导出的文件是二进制格式
file= #设置导出dump文件的路径及名称