1 jmap(Memory Map for Java)作用
一个多功能的命令,它可以生成 java 程序的 dump 文件, 也可以查看堆内对象信息、查看 ClassLoader 的信息以及 finalizer 队列
2 命令格式
jmap [options]
参数解释:
第一个参数:options
- no option: 查看进程的内存映像信息,类似 Solaris pmap 命令。
- heap: 显示Java堆详细信息
- histo[:live]: 显示堆中对象的统计信息
- clstats:打印类加载器信息
- finalizerinfo: 显示在F-Queue队列等待Finalizer线程执行finalizer方法的对象
- dump:生成堆转储快照
3 命令演示
代码如下:
package com.example.demo;
import java.io.IOException;
/*
jmap:
命令像信息
使用不带选项参数的jmap打印共享对象映射,将会打印目标虚拟机中加载的每个共享对象的起始地址、映射大小以及共享对象文件的路径全称
命令:jmap -heap pid
描述:显示Java堆详细信息
打印一个堆的摘要信息,包括使用的GC算法、堆配置信息和各内存区域内存使用信息
命令:jmap -histo:live pid
命令:jmap -histo pid
描述:显示堆中对象的统计信息
其中包括每个Java类、对象数量、内存大小(单位:字节)、完全限定的类名。打印的虚拟机内部的类名称将会带有一个'*'前缀。如果指定了live子选项,则只计算活动的对象
命令:jmap -clstats pid
描述:打印类加载器信息
-clstats是-permstat的替代方案,在JDK8之前,-permstat用来打印类加载器的数据
打印Java堆内存的永久保存区域的类加载器的智能统计信息。对于每个类加载器而言,它的名称、活跃度、地址、父类加载器、它所加载的类的数量和大小都会被打印。此外,包含的字符串数量和大小也会被打印。
命令:jmap -finalizerinfo pid
描述:打印等待终结的对象信息
Number of objects pending for finalization:0 说明当前F-Queue队列中并没有等待Finalizer线程执行finalizer方法的对象。
命令:jmap -dump:live,format=b,file=jmap.bin pid
描述:生成堆转储快照dump文件
以二进制格式转储Java堆到指定filename的文件中。live子选项是可选的。如果指定了live子选项,堆中只有活动的对象会被转储。想要浏览heap dump,你可以使用jhat(Java堆分析工具)读取生成的文件。这个命令执行,JVM会将整个heap的信息dump写入到一个文件,heap如果比较大的话,就会导致这个过程比较耗时,并且执行的过程中为了保证dump的信息是可靠的,所以会暂停应用, 线上系统慎用
*/
public class jmapdemo {
public static void main(String[] args) throws IOException {
jmapdemo jmapdemo1 = new jmapdemo();
System.out.println("jmap");
System.in.read();
}
}
运行后进入命令行工具输入命令。
(1)命令一
jmap pid
描述:查看进程的内存映像信息
使用不带选项参数的jmap打印共享对象映射,将会打印目标虚拟机中加载的每个共享对象的起始地址、映射大小以及共享对象文件的路径全称
如下:
H:\project\jvmtestdemo>jmap 28016
Attaching to process ID 28016, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.261-b12
0x000000005b830000 8624K C:\Program Files\Java\jdk1.8.0_261\jre\bin\server\jvm.dll
0x000000005f400000 52K D:\Program Files (x86)\360\360Safe\safemon\SafeWrapper.dll
0x00007ff7fddc0000 284K C:\Program Files\Java\jdk1.8.0_261\bin\java.exe
0x00007ff862220000 620K C:\Program Files\Java\jdk1.8.0_261\jre\bin\msvcp140.dll
0x00007ff87d6e0000 172K C:\Program Files\Java\jdk1.8.0_261\jre\bin\java.dll
0x00007ff87fd80000 112K C:\Program Files\Java\jdk1.8.0_261\jre\bin\net.dll
0x00007ff880190000 96K C:\Program Files\Java\jdk1.8.0_261\jre\bin\zip.dll
0x00007ff880500000 84K C:\Program Files\Java\jdk1.8.0_261\jre\bin\vcruntime140.dll
0x00007ff892be0000 104K D:\Program Files\JetBrains\IntelliJ IDEA 2019.3.2\bin\breakgen64.dll
0x00007ff896ed0000 64K C:\Program Files\Java\jdk1.8.0_261\jre\bin\verify.dll
0x00007ff89d3d0000 36K C:\WINDOWS\SYSTEM32\WSOCK32.dll
0x00007ff89f940000 200K C:\Program Files\Java\jdk1.8.0_261\jre\bin\instrument.dll
0x00007ff8a3fd0000 2664K C:\WINDOWS\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.19041.4355_none_60b8b9eb71f62e16\COMCTL32.dll
0x00007ff8a4720000 1036K D:\Program Files (x86)\360\360Safe\safemon\libzdtp64.dll
0x00007ff8a4f90000 156K C:\WINDOWS\SYSTEM32\WINMM.dll
0x00007ff8b2650000 72K C:\WINDOWS\SYSTEM32\kernel.appcore.dll
0x00007ff8b2850000 7796K C:\WINDOWS\SYSTEM32\windows.storage.dll
0x00007ff8b3f50000 424K C:\WINDOWS\system32\mswsock.dll
0x00007ff8b41f0000 184K C:\WINDOWS\SYSTEM32\Wldp.dll
0x00007ff8b4390000 40K C:\WINDOWS\SYSTEM32\VERSION.dll
0x00007ff8b4770000 144K C:\WINDOWS\SYSTEM32\profapi.dll
0x00007ff8b48f0000 1116K C:\WINDOWS\System32\gdi32full.dll
0x00007ff8b4a60000 3032K C:\WINDOWS\System32\KERNELBASE.dll
0x00007ff8b4dd0000 156K C:\WINDOWS\System32\bcrypt.dll
0x00007ff8b4e00000 136K C:\WINDOWS\System32\win32u.dll
0x00007ff8b4e30000 1024K C:\WINDOWS\System32\ucrtbase.dll
0x00007ff8b4f30000 628K C:\WINDOWS\System32\msvcp_win.dll
0x00007ff8b51c0000 756K C:\WINDOWS\System32\KERNEL32.DLL
0x00007ff8b5430000 1164K C:\WINDOWS\System32\RPCRT4.dll
0x00007ff8b55e0000 820K C:\WINDOWS\System32\OLEAUT32.dll
0x00007ff8b5830000 172K C:\WINDOWS\System32\GDI32.dll
0x00007ff8b5860000 32K C:\WINDOWS\System32\PSAPI.DLL
0x00007ff8b5870000 704K C:\WINDOWS\System32\ADVAPI32.dll
0x00007ff8b5a60000 7596K C:\WINDOWS\System32\SHELL32.dll
0x00007ff8b62c0000 1660K C:\WINDOWS\System32\USER32.dll
0x00007ff8b6460000 632K C:\WINDOWS\System32\msvcrt.dll
0x00007ff8b6b20000 692K C:\WINDOWS\System32\SHCORE.dll
0x00007ff8b6bd0000 428K C:\WINDOWS\System32\WS2_32.dll
0x00007ff8b6c40000 200K C:\WINDOWS\System32\IMM32.DLL
0x00007ff8b6c80000 3404K C:\WINDOWS\System32\combase.dll
0x00007ff8b7050000 640K C:\WINDOWS\System32\sechost.dll
0x00007ff8b70f0000 340K C:\WINDOWS\System32\SHLWAPI.dll
0x00007ff8b7190000 2016K C:\WINDOWS\SYSTEM32\ntdll.dll
(2)命令二
jmap -heap pid
描述:显示Java堆详细信息
打印一个堆的摘要信息,包括使用的GC算法、堆配置信息和各内存区域内存使用信息
如下:
H:\project\jvmtestdemo>jmap -heap 28016
Attaching to process ID 28016, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 25.261-b12
using thread-local object allocation.
Parallel GC with 10 thread(s)
Heap Configuration:
MinHeapFreeRatio = 0
MaxHeapFreeRatio = 100
MaxHeapSize = 10697572352 (10202.0MB)
NewSize = 222822400 (212.5MB)
MaxNewSize = 3565682688 (3400.5MB)
OldSize = 446169088 (425.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 = 167247872 (159.5MB)
used = 13379896 (12.760063171386719MB)
free = 153867976 (146.73993682861328MB)
8.00003960588509% used
From Space:
capacity = 27787264 (26.5MB)
used = 0 (0.0MB)
free = 27787264 (26.5MB)
0.0% used
To Space:
capacity = 27787264 (26.5MB)
used = 0 (0.0MB)
free = 27787264 (26.5MB)
0.0% used
PS Old Generation
capacity = 446169088 (425.5MB)
used = 0 (0.0MB)
free = 446169088 (425.5MB)
0.0% used
3185 interned Strings occupying 261152 bytes.
(3)命令三
jmap -histo:live pid
描述:显示堆中对象的统计信息
其中包括每个Java类、对象数量、内存大小(单位:字节)、完全限定的类名。打印的虚拟机内部的类名称将会带有一个'*'前缀。如果指定了live子选项,则只计算活动的对象
如下:
H:\project\jvmtestdemo>jmap -histo:live 28016
num #instances #bytes class name
----------------------------------------------
1: 4586 439440 [C
2: 420 135856 [B
3: 4437 106488 java.lang.String
4: 706 80896 java.lang.Class
5: 634 41568 [Ljava.lang.Object;
6: 791 31640 java.util.TreeMap$Entry
7: 629 25160 java.util.LinkedHashMap$Entry
8: 425 19040 [Ljava.lang.String;
9: 373 11936 java.util.HashMap$Node
10: 24 8640 [Ljava.util.HashMap$Node;
11: 113 8136 java.lang.reflect.Field
12: 132 7664 [I
13: 87 5568 java.net.URL
14: 110 4400 java.lang.ref.SoftReference
15: 256 4096 java.lang.Integer
16: 121 3872 java.util.Hashtable$Entry
17: 107 3424 java.util.concurrent.ConcurrentHashMap$Node
18: 8 3008 java.lang.Thread
19: 42 2352 sun.misc.URLClassPath$JarLoader
20: 26 2080 java.lang.reflect.Constructor
21: 15 1968 [Ljava.util.concurrent.ConcurrentHashMap$Node;
22: 39 1872 sun.util.locale.LocaleObjectCache$CacheEntry
23: 43 1720 java.lang.ref.Finalizer
24: 34 1632 java.util.HashMap
25: 1 1568 [[B
26: 93 1488 java.lang.Object
27: 37 1480 java.io.ObjectStreamField
28: 26 1456 java.lang.Class$ReflectionData
29: 20 1280 java.util.concurrent.ConcurrentHashMap
30: 15 1200 [Ljava.util.WeakHashMap$Entry;
31: 9 1184 [Ljava.util.Hashtable$Entry;
32: 2 1064 [Ljava.lang.invoke.MethodHandle;
33: 1 1040 [Ljava.lang.Integer;
34: 1 1040 [[C
35: 41 984 java.io.ExpiringCache$Entry
36: 15 840 sun.nio.cs.UTF_8$Encoder
37: 12 768 java.util.jar.JarFile
38: 19 760 sun.util.locale.BaseLocale$Key
39: 15 720 java.util.WeakHashMap
40: 22 704 java.lang.ref.ReferenceQueue
41: 7 672 java.util.jar.JarFile$JarFileEntry
42: 12 672 java.util.zip.ZipFile$ZipFileInputStream
43: 11 648 [Ljava.lang.reflect.Field;
44: 8 640 [S
45: 19 608 java.io.File
46: 19 608 java.util.Locale
47: 19 608 sun.util.locale.BaseLocale
48: 13 520 java.security.AccessControlContext
49: 21 504 java.util.jar.Attributes$Name
50: 19 456 java.util.Locale$LocaleKey
51: 18 432 sun.misc.MetaIndex
52: 10 400 java.io.FileDescriptor
53: 10 400 sun.nio.cs.UTF_8$Decoder
54: 13 392 [Ljava.io.ObjectStreamField;
55: 1 384 com.intellij.rt.execution.application.AppMainV2$1
56: 1 384 java.lang.ref.Finalizer$FinalizerThread
57: 24 384 java.lang.ref.ReferenceQueue$Lock
58: 6 384 java.nio.DirectByteBuffer
59: 12 384 java.util.zip.ZipCoder
60: 1 376 java.lang.ref.Reference$ReferenceHandler
61: 18 352 [Ljava.lang.Class;
62: 6 336 java.nio.DirectLongBufferU
63: 10 320 java.lang.OutOfMemoryError
64: 3 312 [D
65: 13 312 [Ljava.lang.reflect.Constructor;
66: 13 312 sun.reflect.NativeConstructorAccessorImpl
67: 12 288 java.util.ArrayDeque
68: 3 264 java.lang.reflect.Method
69: 11 264 java.net.StandardSocketOptions$StdSocketOption
70: 11 264 java.util.ArrayList
71: 8 256 java.util.Vector
72: 3 240 [Ljava.lang.ThreadLocal$ThreadLocalMap$Entry;
73: 5 240 java.util.Hashtable
74: 6 240 java.util.WeakHashMap$Entry
75: 7 224 java.lang.ThreadLocal$ThreadLocalMap$Entry
76: 4 224 java.util.LinkedHashMap
77: 4 224 sun.util.calendar.ZoneInfo
78: 9 216 java.util.LinkedList$Node
79: 13 208 sun.reflect.DelegatingConstructorAccessorImpl
80: 5 200 java.security.ProtectionDomain
81: 6 192 java.io.FileInputStream
82: 4 192 java.util.Properties
83: 4 192 java.util.TreeMap
84: 2 160 [[Ljava.lang.String;
85: 4 160 java.lang.ClassLoader$NativeLibrary
86: 5 160 java.security.CodeSource
87: 5 160 java.util.LinkedList
88: 5 160 sun.util.locale.provider.LocaleProviderAdapter$Type
89: 3 144 java.nio.HeapByteBuffer
90: 6 144 sun.misc.PerfCounter
91: 3 144 sun.misc.URLClassPath
92: 2 128 java.io.ExpiringCache$1
93: 4 128 java.util.Stack
94: 2 128 sun.nio.cs.ext.DoubleByte$Encoder
95: 1 120 java.net.SocksSocketImpl
96: 5 120 java.util.Collections$UnmodifiableRandomAccessList
97: 5 120 sun.misc.FloatingDecimal$PreparedASCIIToBinaryBuffer
98: 2 112 java.lang.Package
99: 7 112 java.util.HashSet
100: 2 112 java.util.ResourceBundle$CacheKey
101: 2 112 java.util.zip.ZipFile$ZipFileInflaterInputStream
102: 2 112 sun.nio.cs.ext.DoubleByte$Decoder
103: 3 96 java.io.FileOutputStream
104: 4 96 java.lang.RuntimePermission
105: 3 96 java.lang.StringCoding$StringEncoder
106: 2 96 java.lang.ThreadGroup
107: 6 96 java.lang.ThreadLocal
108: 1 96 java.net.DualStackPlainSocketImpl
109: 2 96 java.util.ResourceBundle$BundleReference
110: 2 96 java.util.zip.Inflater
111: 4 96 jdk.net.ExtendedSocketOptions$ExtSocketOption
112: 1 96 sun.misc.Launcher$AppClassLoader
113: 3 96 sun.net.spi.DefaultProxySelector$NonProxyInfo
114: 2 96 sun.nio.cs.StreamEncoder
115: 1 88 sun.misc.Launcher$ExtClassLoader
116: 5 80 [Ljava.security.Principal;
117: 2 80 java.io.BufferedWriter
118: 2 80 java.io.ExpiringCache
119: 5 80 java.security.ProtectionDomain$Key
120: 2 80 sun.misc.FloatingDecimal$BinaryToASCIIBuffer
121: 3 72 java.lang.ThreadLocal$ThreadLocalMap
122: 3 72 java.net.Proxy$Type
123: 3 72 java.util.Arrays$ArrayList
124: 1 72 java.util.ResourceBundle$RBClassLoader
125: 3 72 java.util.concurrent.atomic.AtomicLong
126: 3 72 sun.misc.FloatingDecimal$ExceptionalBinaryToASCIIBuffer
127: 1 72 sun.util.locale.provider.JRELocaleProviderAdapter
128: 1 64 [F
129: 2 64 [Ljava.lang.Thread;
130: 2 64 java.io.FilePermission
131: 2 64 java.io.PrintStream
132: 2 64 java.lang.ClassValue$Entry
133: 2 64 java.lang.StringCoding$StringDecoder
134: 2 64 java.lang.VirtualMachineError
135: 2 64 java.lang.ref.ReferenceQueue$Null
136: 2 64 java.lang.ref.WeakReference
137: 2 64 java.security.BasicPermissionCollection
138: 2 64 java.security.Permissions
139: 2 64 java.util.ResourceBundle$LoaderReference
140: 1 48 [J
141: 2 48 [Ljava.lang.reflect.Method;
142: 2 48 java.io.BufferedOutputStream
143: 1 48 java.io.BufferedReader
144: 2 48 java.io.File$PathStatus
145: 2 48 java.io.FilePermissionCollection
146: 2 48 java.io.OutputStreamWriter
147: 2 48 java.net.InetAddress$Cache
148: 2 48 java.net.InetAddress$Cache$Type
149: 1 48 java.net.SocketInputStream
150: 1 48 java.nio.HeapCharBuffer
151: 2 48 java.nio.charset.CoderResult
152: 3 48 java.nio.charset.CodingErrorAction
153: 3 48 java.util.Collections$UnmodifiableSet
154: 3 48 java.util.HashMap$KeySet
155: 2 48 java.util.zip.ZStreamRef
156: 2 48 sun.misc.NativeSignalHandler
157: 2 48 sun.misc.Signal
158: 3 48 sun.net.www.protocol.jar.Handler
159: 1 48 sun.nio.cs.StreamDecoder
160: 1 48 sun.nio.cs.US_ASCII$Decoder
161: 1 48 sun.util.resources.TimeZoneNames
162: 1 48 sun.util.resources.en.TimeZoneNames_en
163: 1 40 [Lsun.util.locale.provider.LocaleProviderAdapter$Type;
164: 1 40 java.io.BufferedInputStream
165: 1 40 java.util.ResourceBundle$1
166: 1 40 sun.nio.cs.StandardCharsets$Aliases
167: 1 40 sun.nio.cs.StandardCharsets$Cache
168: 1 40 sun.nio.cs.StandardCharsets$Classes
169: 1 40 sun.nio.cs.ext.ExtendedCharsets
170: 1 32 [Ljava.lang.OutOfMemoryError;
171: 2 32 [Ljava.lang.StackTraceElement;
172: 1 32 [Ljava.lang.ThreadGroup;
173: 1 32 [Ljava.net.Proxy$Type;
174: 1 32 java.io.WinNTFileSystem
175: 1 32 java.lang.ArithmeticException
176: 2 32 java.lang.Boolean
177: 1 32 java.lang.NullPointerException
178: 1 32 java.net.InetAddress$InetAddressHolder
179: 1 32 java.net.Socket
180: 2 32 java.nio.ByteOrder
181: 2 32 java.util.LinkedHashMap$LinkedKeySet
182: 2 32 java.util.concurrent.atomic.AtomicInteger
183: 1 32 java.util.concurrent.atomic.AtomicReferenceFieldUpdater$AtomicReferenceFieldUpdaterImpl
184: 1 32 jdk.net.ExtendedSocketOptions$1
185: 1 32 sun.instrument.InstrumentationImpl
186: 1 32 sun.nio.cs.StandardCharsets
187: 1 32 sun.util.locale.provider.LocaleResources
188: 1 32 sun.util.locale.provider.LocaleServiceProviderPool
189: 1 24 [Ljava.io.File$PathStatus;
190: 1 24 [Ljava.lang.ClassValue$Entry;
191: 1 24 [Ljava.net.InetAddress$Cache$Type;
192: 1 24 [Ljava.security.ProtectionDomain;
193: 1 24 [Lsun.launcher.LauncherHelper;
194: 1 24 java.io.InputStreamReader
195: 1 24 java.lang.ClassValue$Version
196: 1 24 java.lang.StringBuilder
197: 1 24 java.lang.invoke.MethodHandleImpl$4
198: 1 24 java.lang.reflect.ReflectPermission
199: 1 24 java.net.Inet4Address
200: 1 24 java.net.Inet6AddressImpl
201: 1 24 java.net.Proxy
202: 1 24 java.util.BitSet
203: 1 24 java.util.Collections$EmptyMap
204: 1 24 java.util.Collections$SetFromMap
205: 1 24 java.util.Collections$SynchronizedSet
206: 1 24 java.util.Locale$Cache
207: 1 24 java.util.ResourceBundle$Control$CandidateListCache
208: 1 24 java.util.jar.Manifest
209: 1 24 sun.instrument.TransformerManager
210: 1 24 sun.launcher.LauncherHelper
211: 1 24 sun.misc.JarIndex
212: 1 24 sun.misc.URLClassPath$FileLoader
213: 1 24 sun.nio.cs.ISO_8859_1
214: 1 24 sun.nio.cs.ThreadLocalCoders$1
215: 1 24 sun.nio.cs.ThreadLocalCoders$2
216: 1 24 sun.nio.cs.US_ASCII
217: 1 24 sun.nio.cs.UTF_16
218: 1 24 sun.nio.cs.UTF_16BE
219: 1 24 sun.nio.cs.UTF_16LE
220: 1 24 sun.nio.cs.UTF_8
221: 1 24 sun.nio.cs.ext.GBK
222: 1 24 sun.reflect.NativeMethodAccessorImpl
223: 1 24 sun.util.locale.BaseLocale$Cache
224: 1 24 sun.util.locale.provider.TimeZoneNameProviderImpl
225: 1 16 [Ljava.lang.Throwable;
226: 1 16 [Ljava.security.cert.Certificate;
227: 1 16 [Lsun.instrument.TransformerManager$TransformerInfo;
228: 1 16 com.example.demo.jmapdemo
229: 1 16 java.io.FileDescriptor$1
230: 1 16 java.lang.CharacterDataLatin1
231: 1 16 java.lang.ClassValue$Identity
232: 1 16 java.lang.Runtime
233: 1 16 java.lang.String$CaseInsensitiveComparator
234: 1 16 java.lang.System$2
235: 1 16 java.lang.Terminator$1
236: 1 16 java.lang.invoke.MemberName$Factory
237: 1 16 java.lang.invoke.MethodHandleImpl$2
238: 1 16 java.lang.invoke.MethodHandleImpl$3
239: 1 16 java.lang.ref.Reference$1
240: 1 16 java.lang.ref.Reference$Lock
241: 1 16 java.lang.reflect.ReflectAccess
242: 1 16 java.net.InetAddress$2
243: 1 16 java.net.URLClassLoader$7
244: 1 16 java.nio.Bits$1
245: 1 16 java.nio.charset.CoderResult$1
246: 1 16 java.nio.charset.CoderResult$2
247: 1 16 java.security.ProtectionDomain$2
248: 1 16 java.security.ProtectionDomain$JavaSecurityAccessImpl
249: 1 16 java.util.Collections$EmptyIterator
250: 1 16 java.util.Collections$EmptyList
251: 1 16 java.util.Collections$EmptySet
252: 1 16 java.util.HashMap$EntrySet
253: 1 16 java.util.Hashtable$EntrySet
254: 1 16 java.util.ResourceBundle$Control
255: 1 16 java.util.WeakHashMap$KeySet
256: 1 16 java.util.concurrent.atomic.AtomicBoolean
257: 1 16 java.util.jar.Attributes
258: 1 16 java.util.jar.JavaUtilJarAccessImpl
259: 1 16 java.util.zip.ZipFile$1
260: 1 16 jdk.net.ExtendedSocketOptions$PlatformSocketOptions
261: 1 16 sun.misc.ASCIICaseInsensitiveComparator
262: 1 16 sun.misc.FloatingDecimal$1
263: 1 16 sun.misc.Launcher
264: 1 16 sun.misc.Launcher$Factory
265: 1 16 sun.misc.Perf
266: 1 16 sun.misc.Unsafe
267: 1 16 sun.net.spi.DefaultProxySelector
268: 1 16 sun.net.www.protocol.file.Handler
269: 1 16 sun.reflect.DelegatingMethodAccessorImpl
270: 1 16 sun.reflect.ReflectionFactory
271: 1 16 sun.util.calendar.Gregorian
272: 1 16 sun.util.locale.provider.AuxLocaleProviderAdapter$NullProvider
273: 1 16 sun.util.locale.provider.SPILocaleProviderAdapter
274: 1 16 sun.util.locale.provider.TimeZoneNameUtility$TimeZoneNameGetter
275: 1 16 sun.util.resources.LocaleData
276: 1 16 sun.util.resources.LocaleData$LocaleDataResourceBundleControl
Total 15227 994896
(4)命令四
jmap -histo pid
描述:显示堆中对象的统计信息
其中包括每个Java类、对象数量、内存大小(单位:字节)、完全限定的类名。打印的虚拟机内部的类名称将会带有一个'*'前缀。如果指定了live子选项,则只计算活动的对象
(5)命令五
jmap -clstats pid
描述:打印类加载器信息
-clstats是-permstat的替代方案,在JDK8之前,-permstat用来打印类加载器的数据
打印Java堆内存的永久保存区域的类加载器的智能统计信息。对于每个类加载器而言,它的名称、活跃度、地址、父类加载器、它所加载的类的数量和大小都会被打印。此外,包含的字符串数量和大小也会被打印。
(6)命令六
jmap -finalizerinfo pid
描述:打印等待终结的对象信息
Number of objects pending for finalization:0 说明当前F-Queue队列中并没有等待Finalizer线程执行finalizer方法的对象。
(7)命令七
jmap -dump:live,format=b,file=d:\jmap.bin pid
描述:生成堆转储快照dump文件
以hprof二进制格式转储Java堆到指定filename的文件中。live子选项是可选的。如果指定了live子选项,堆中只有活动的对象会被转储。想要浏览heap dump,你可以使用jhat(Java堆分析工具)读取生成的文件。这个命令执行,JVM会将整个heap的信息dump写入到一个文件,heap如果比较大的话,就会导致这个过程比较耗时,并且执行的过程中为了保证dump的信息是可靠的,所以会暂停应用, 线上系统慎用