JDK内置工具-jmap

"jmap" - Memory Map: Prints shared object memory maps or heap memory details of a given JVM process or a Java core file on the local machine or on a remote machine through a debug server. "jmap" supports several functions with these syntaxes:

jmap [ option ] pid
jmap [ option ] executable core
jmap [ option ] [server-id@]remote-hostname-or-IP

<no option>
    When no option is used jmap prints shared object mappings. 
    For each shared object loaded in the target VM, start address, 
    the size of the mapping, and the full path of the shared object 
    file are printed. This is similar to the Solaris pmap utility.

-dump:[live,]format=b,file=<filename>
    Dumps the Java heap in hprof binary format to filename. The live
    suboption is optional. If specified, only the live objects in the
    heap are dumped. To browse the heap dump, you can use jhat (Java 
    Heap Analysis Tool) to read the generated file.

-finalizerinfo
    Prints information on objects awaiting finalization.

-heap
    Prints a heap summary. GC algorithm used, heap configuration and 
    generation wise heap usage are printed.

-histo[:live]
    Prints a histogram of the heap. For each Java class, number of 
    objects, memory size in bytes, and fully qualified class names 
    are printed. VM internal class names are printed with '*' prefix. 
    If the live suboption is specified, only live objects are counted.

-permstat
    Prints class loader wise statistics of permanent generation of 
    Java heap. For each class loader, its name, liveness, address, 
    parent class loader, and the number and size of classes it has 
    loaded are printed. In addition, the number and size of interned 
    Strings are printed. 

-F
    Force. Use with jmap -dump or jmap -histo option if the pid does 
    not respond. The live suboption is not supported in this mode.

The "jmap" tool included in the Windows version of JDK supports functions to print histogram of Java object heap and generate a heap dump of a given JVM process:

C:\herong>\Progra~1\java\jdk1.8.0\bin\jmap

Usage:
    jmap -histo <pid>
      (to print histogram of java object heap of the JVM process)
    jmap -dump:<dump-options> <pid>
      (to dump java heap of the JVM process)

    dump-options:
      format=b     binary default
      file=<file>  dump heap to <file>

    Example: jmap -dump:format=b,file=heap.bin <pid>
             jmap -dump:format=b,file=/tmp/heap.bin 13629(备注:可以指定输出的文件路径)

See the next section on how to use "jmap" to print heap histogram and to generate heap dump.

Last update: 2015.


DESCRIPTION:注意

jmap prints shared object memory maps or heap memory details of a given process or core file or a remote debug server. If the given process is running on a 64-bit VM, you may need to specify the -J-d64option, e.g.:

jmap -J-d64 -heap pid


转载于:https://my.oschina.net/u/2308739/blog/608481

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值