检查 Java 元空间区域的内容( 三 )


1: 143036 75523008 [Ljavassist.bytecode.ConstInfo;
2: 718060 70032224 [C
3: 1573553 50353696 java.util.HashMap$Node
4: 430124 24732832 [Ljava.lang.Object;
5: 1001290 24030960 javassist.bytecode.Utf8Info
6: 858268 20598432 java.util.ArrayList
7: 718037 17232888 java.lang.String
8: 144011 14987488 java.lang.Class
9: 143081 11447152 [Ljava.util.HashMap$Node;
10: 143036 9154304 javassist.bytecode.ClassFile
11: 143035 9154240 javassist.CtNewClass
12: 286124 6892400 [B
13: 143085 6868080 java.util.HashMap
14: 286078 6865872 javassist.bytecode.ClassInfo
15: 143036 6865728 [[Ljavassist.bytecode.ConstInfo;
16: 143049 5721960 javassist.bytecode.MethodInfo
17: 143042 5721680 javassist.bytecode.CodeAttribute
18: 143323 4586336 java.util.Hashtable$Entry
19: 143038 4577216 java.lang.ref.WeakReference
20: 143036 4577152 javassist.bytecode.ConstPool
21: 143045 3433080 javassist.bytecode.MethodrefInfo
22: 143045 3433080 javassist.bytecode.NameAndTypeInfo
23: 143042 3433008 javassist.bytecode.ExceptionTable
24: 143036 3432864 javassist.bytecode.LongVector
25: 143036 3432864 javassist.bytecode.SourceFileAttribute
26: 143622 2323336 [I
27: 10 788688 [Ljava.util.Hashtable$Entry;
28: 642 20544 java.util.concurrent.ConcurrentHashMap$Node
29: 244 13664 java.lang.invoke.MemberName
30: 341 10912 sun.misc.FDBigInteger
31: 212 8480 java.lang.ref.SoftReference
32: 140 8400 [Ljava.lang.ref.SoftReference;
33: 234 7488 java.lang.invoke.LambdaForm$Name
34: 176 7040 java.lang.invoke.MethodType
35: 256 6144 java.lang.Long
36: 16 6016 java.lang.Thread
37: 173 5880 [Ljava.lang.Class;
38: 366 5856 java.lang.Object
39: 177 5664 java.lang.invoke.MethodType$ConcurrentWeakInternSet$WeakEntry
40: 10 5280 [Ljava.util.concurrent.ConcurrentHashMap$Node;
41: 256 4096 java.lang.Byte
42: 256 4096 java.lang.Integer
43: 256 4096 java.lang.Short
44: 73 4088 java.lang.invoke.MethodTypeForm
45: 82 3808 [Ljava.lang.invoke.LambdaForm$Name;
46: 77 3696 java.lang.invoke.LambdaForm
4. 程序化方法
您还可以使用编程方法打印加载到内存中的类 。开源 Guava 库提供 API 来打印加载的类 。下面是利用 Guava 库在内存中打印加载的类的代码示例:
ClassPath classPath = ClassPath.from(BuggyAppLoader.class.getClassLoader());
Set classes = classPath.getAllClasses();
for(ClassInfo classInfo : classes) {
logger.info(classInfo.getName());
}
org.Apache.catalina.core.AsyncContextImpl
org.apache.catalina.core.AsyncListenerWrapper
org.apache.catalina.core.Constants
org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor
org.apache.catalina.core.ContainerBase$PrivilegedAddChild
org.apache.catalina.core.ContainerBase$StartChild
org.apache.catalina.core.ContainerBase$StartStopThreadFactory
org.apache.catalina.core.ContainerBase$StopChild
org.apache.catalina.core.ContainerBase
org.apache.catalina.core.DefaultInstanceManager$1
org.apache.catalina.core.DefaultInstanceManager$2
org.apache.catalina.core.DefaultInstanceManager$3
org.apache.catalina.core.DefaultInstanceManager$AnnotationCacheEntry
org.apache.catalina.core.DefaultInstanceManager$AnnotationCacheEntryType
org.apache.catalina.core.DefaultInstanceManager
org.apache.catalina.core.JreMemoryLeakPreventionListener
org.apache.catalina.core.NamingContextListener
org.apache.catalina.core.StandardContext$1
org.apache.catalina.core.StandardContext$ContextFilterMaps
org.apache.catalina.core.StandardContext$NoPluggabilityServletContext
org.apache.catalina.core.StandardContext
org.apache.catalina.core.StandardContextValve
org.apache.catalina.core.StandardEngine$AccessLogListener
org.apache.catalina.core.StandardEngine$NoopAccessLog
org.apache.catalina.core.StandardEngine
org.apache.catalina.core.StandardEngineValve
org.apache.catalina.core.StandardHost$1
org.apache.catalina.core.StandardHost$MemoryLeakTrackingListener
org.apache.catalina.core.StandardHost
org.apache.catalina.core.StandardHostValve
org.apache.catalina.core.StandardPipeline
org.apache.catalina.core.StandardServer
org.apache.catalina.core.StandardService
org.apache.catalina.core.StandardThreadExecutor
org.apache.catalina.core.StandardWrapper
org.apache.catalina.core.StandardWrapperFacade
org.apache.catalina.core.StandardWrapperValve
org.apache.catalina.core.ThreadLocalLeakPreventionListener
5.堆转储分析
查看加载到内存中的类的另一个选项是检查堆转储 。堆转储报告加载到内存中的所有数据、对象和类 。您可以使用此处给出的一种方法来捕获堆转储 。捕获堆转储后,您可以使用Eclipse MAT和HeapHero等堆转储分析工具来分析堆转储 。


推荐阅读