Linux jmap查看Java程序堆内存的使用情况

来源:互联网 发布:贵阳行知学校 编辑:程序博客网 时间:2024/05/29 07:48

敲jmap命令后,显示下面的命令

[root@~]# jmap

Usage:
    jmap [option] <pid>
        (to connect to running process)
    jmap [option] <executable <core>
        (to connect to a core file)
    jmap [option] [server_id@]<remote server IP or hostname>
        (to connect to remote debug server)


where <option> is one of:
    <none>               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:<dump-options> 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=<file>  dump heap to <file>
                         Example: jmap -dump:live,format=b,file=heap.bin <pid>
    -F                   force. Use with -dump:<dump-options> <pid> or -histo
                         to force a heap dump or histogram when <pid> does not
                         respond. The "live" suboption is not supported
                         in this mode.
    -h | -help           to print this help message

    -J<flag>             to pass <flag> directly to the runtime system


查看Java进程的堆内存:


[root@~]# jmap -heap 21945
Attaching to process ID 21945, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.131-b11


using thread-local object allocation.
Parallel GC with 4 thread(s)


Heap Configuration:
   MinHeapFreeRatio         = 0
   MaxHeapFreeRatio         = 100
   MaxHeapSize              = 8589934592 (8192.0MB)
   NewSize                  = 85983232 (82.0MB)
   MaxNewSize               = 2863136768 (2730.5MB)
   OldSize                  = 171966464 (164.0MB)
   NewRatio                 = 2
   SurvivorRatio            = 8
   MetaspaceSize            = 21807104 (20.796875MB)
   CompressedClassSpaceSize = 1073741824 (1024.0MB)
   MaxMetaspaceSize         = 17592186044415 MB
   G1HeapRegionSize         = 0 (0.0MB)


Heap Usage:
PS Young Generation
Eden Space:
   capacity = 2672820224 (2549.0MB)
   used     = 2157300352 (2057.3619384765625MB)
   free     = 515519872 (491.6380615234375MB)
   80.71251229802128% used
From Space:
   capacity = 92274688 (88.0MB)
   used     = 55943632 (53.35200500488281MB)
   free     = 36331056 (34.64799499511719MB)
   60.62727841463956% used
To Space:
   capacity = 92798976 (88.5MB)
   used     = 0 (0.0MB)
   free     = 92798976 (88.5MB)
   0.0% used
PS Old Generation
   capacity = 267386880 (255.0MB)
   used     = 212261904 (202.42872619628906MB)
   free     = 55124976 (52.57127380371094MB)
   79.38381419462316% used


25268 interned Strings occupying 2942544 bytes.