GCRoots 是由哪些对象组成的

简介: GCRoots 是由哪些对象组成的

参考文档

GCRoot 是一个可以从堆外访问的对象

1. System Class (被boostrap 类加载器加载的系统类。如rt.jar)
    Class loaded by bootstrap/system class loader. For example, everything from the rt.jar like java.util.* .
   
2. JNI Local( 一些用户定义jni code或者jvm的内部代码局部变量)
    Local variable in native code, such as user defined JNI code or JVM internal code.
    
3. JNI Global( jni 代码中的全局变量)
    Global variable in native code, such as user defined JNI code or 4. JVM internal code.(jvm内部的代码)
     
5. Thread Block(被阻塞的线程类 Thread.state)
    Object referred to from a currently active thread block.

6. Thread 正在运行的线程
    A started, but not stopped, thread.
    
7. Busy Monitor(正在等待的线程。Thread.state ==WAITING)
    Everything that has called wait() or notify() or that is synchronized. For example, by calling synchronized(Object) or by entering a synchronized method. Static method means class, non-static method means object.
    
8. Java Local(局部变量,比如一些方法传入参数或线程栈中方法创建的对象)
    Local variable. For example, input parameters or locally created objects of methods that are still in the stack of a thread.

9.Native Stack(本地方法栈中输入或输出参数,如io、文件方法或反射的参数)
    In or out parameters in native code, such as user defined JNI code or JVM internal code. This is often the case as many methods have native parts and the objects handled as method parameters become GC roots. For example, parameters used for file/network I/O methods or reflection.
    
10.Finalizable(在回收队列中的对象)
    An object which is in a queue awaiting its finalizer to be run.
    
11. Unfinalized(覆盖了finalize方法的对象但是还没有被放入回收队列中的对象)
    An object which has a finalize method, but has not been finalized and is not yet on the finalizer queue.

12.Unreachable(从任何其他根无法访问的对象,但由Memory Analyzer标记为根,以便该对象可以包含在分析中)
    An object which is unreachable from any other root, but has been marked as a root by MAT to retain objects which otherwise would not be included in the analysis.

13. Java Stack Frame(java栈帧的举报变量,仅当您将“首选项”设置为将Java堆栈帧视为对象时,才会生成此类型的垃圾收集根)
    A Java stack frame, holding local variables. Only generated when the dump is parsed with the preference set to treat Java stack frames as objects.
    
14. Unknown
  An object of unknown root type. Some dumps, such as IBM Portable Heap Dump files, do not have root information. For these dumps the MAT parser marks objects which are have no inbound references or are unreachable from any other root as roots of this type. This ensures that MAT retains all the objects in the dump.

总结来说:

  • 活着的线程,包含处于等待或阻塞的线程
  • java方法区/本地方法区中静态变量、常量引用的对象
  • 虚拟机栈中的变量的对象引用
目录
相关文章
|
11天前
|
JSON 程序员 C#
使用 C# 比较两个对象是否相等的7个方法总结
比较对象是编程中的一项基本技能,在实际业务中经常碰到,比如在ERP系统中,企业的信息非常重要,每一次更新,都需要比较记录更新前后企业的信息,直接比较通常只能告诉我们它们是否指向同一个内存地址,那我们应该怎么办呢?分享 7 个方法给你!
|
6月前
|
C++
C++中的对象
C++中的对象
56 2
|
6月前
|
测试技术 索引
v-for 与对象
v-for 与对象
|
前端开发
67 # 对象的处理
67 # 对象的处理
36 0
|
存储 程序员 编译器
C++都有对象了,你还没有吗?
C++都有对象了,你还没有吗?
84 0
|
Java 开发者 容器
你有对象吗?
你有对象吗?
107 0
|
存储 JSON Java
谈“对象“
谈“对象“
|
存储 编译器 C语言
我现在必须new一个对象!!!
C++内存管理,手动开辟空间,我现在必须new一个对象!!!
89 0
我现在必须new一个对象!!!
|
算法 Java
对象的比较
本篇文章是对Java中一些常见的比较的总结,在涉及到比较方面,有元素的比较与对象的比较,下边博主来带领大家一起了解这些比较方式。
109 0
下一篇
无影云桌面