jmap 内存情况

原创
2018/08/16 10:18
阅读数 81

-dump

dump堆到文件,format指定输出格式,live指明是活着的对象,file指定文件名

[root@localhost ~]# jmap -dump:live,format=b,file=dump.hprof 187784
Dumping heap to /home/yxgly/dump.hprof ...
Heap dump file created

 

-heap

打印heap空间的概要

[root@localhost jdk1.8.0_111]# /usr/local/jdk1.8.0_111/bin/jmap -heap 187784
Attaching to process ID 187784, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.111-b14

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

Heap Configuration:
   MinHeapFreeRatio         = 0
   MaxHeapFreeRatio         = 100
   MaxHeapSize              = 6442450944 (6144.0MB)
   NewSize                  = 1789394944 (1706.5MB)
   MaxNewSize               = 2147483648 (2048.0MB)
   OldSize                  = 3579314176 (3413.5MB)
   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 = 1683488768 (1605.5MB)
   used     = 1241471032 (1183.9590377807617MB)
   free     = 442017736 (421.5409622192383MB)
   73.74394505018759% used
From Space:
   capacity = 54001664 (51.5MB)
   used     = 37876168 (36.12152862548828MB)
   free     = 16125496 (15.378471374511719MB)
   70.1388905349287% used
To Space:
   capacity = 54525952 (52.0MB)
   used     = 0 (0.0MB)
   free     = 54525952 (52.0MB)
   0.0% used
PS Old Generation
   capacity = 3926917120 (3745.0MB)
   used     = 312241416 (297.77661895751953MB)
   free     = 3614675704 (3447.2233810424805MB)
   7.951311587650721% used

79807 interned Strings occupying 9359152 bytes.

注意:系统中有多个JDK安装,指定具体的jmap


-histo

打印堆的对象统计,包括对象数、内存大小等

jmap -histo [pid] | head -20 查看top20的实例个数以及内存占用情况

[root@TA30-53 ~]# jmap -histo 31650|head -20

 num     #instances         #bytes  class name
----------------------------------------------
   1:        696339      171926288  [B
   2:        827413      115263552  [C
   3:         12426       47603720  [I
   4:        824749       19793976  java.lang.String
   5:         74743        6577384  org.apache.naming.resources.FileDirContext$FileResourceAttributes
   6:        192165        6149280  java.util.HashMap$Node
   7:        103517        4140680  java.util.LinkedHashMap$Entry
   8:         43700        3622920  [Ljava.lang.Object;
   9:         33699        2965512  java.lang.reflect.Method
  10:         23343        2865520  [Ljava.util.HashMap$Node;
  11:         79293        2537376  java.io.File
  12:         74768        1794432  java.io.ExpiringCache$Entry
  13:         15295        1708440  java.lang.Class
  14:         25572        1227456  java.util.HashMap
  15:         40743         977832  java.util.ArrayList
  16:         29255         936160  java.util.concurrent.ConcurrentHashMap$Node
  17:          6157         763776  [Ljava.lang.String;

 

展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部