previous      content      next
 
GC roots

The so-called GC (Garbage Collector) roots are objects special for garbage
collector. Garbage collector collects those objects that are not GC roots and
are not accessible by references from GC roots.

There are several kinds of GC roots. One object can belong to more than one
kind of root. The root kinds are:

  • Class - class loaded by system class loader. Such classes can never
    be unloaded. They can hold objects via static fields. Please note that classes
    loaded by custom class loaders are not roots, unless corresponding instances of
    java.lang.Class happen to be roots of other kind(s).
  • Thread - live thread
  • Stack Local - local variable or parameter of Java method
  • JNI Local - local variable or parameter of JNI method
  • JNI Global - global JNI reference
  • Monitor Used - objects used as a monitor for synchronization
  • Held by JVM - objects held from garbage collection by JVM for its
    purposes. Actually the list of such objects depends on JVM implementation.
    Possible known cases are: the system class loader, a few important exception
    classes which the JVM knows about, a few pre-allocated objects for exception
    handling, and custom class loaders when they are in the process of loading
    classes. Unfortunately, JVM provides absolutely no additional detail for such
    objects. Thus it is up to the analyst to decide to which case a certain "Held by
    JVM" belongs.

If an object is a root, it is specially marked in all views showing
individual objects. For example, the following picture shows a fragment of paths view:

 
previous      content      next
 

GC roots 总结的更多相关文章

  1. gc roots 垃圾回收

    gc roots包括以下几个: 虚拟机栈(栈桢中的本地变量表)中的引用对象 方法区中的类静态属性引用的对象 方法区中的常量引用的对象 本地方法栈中JNI(即native方法)的引用的对象 java,c ...

  2. 枚举GC Roots的实现

    枚举根节点 从可达性分析中从GC Roots节点找引用链这个操作为例,可作为GC Roots的节点主要在全局性的引用(例如常量或类静态属性)与执行上下文(例如栈帧中的本地变量表)中,现在很多应用仅仅方 ...

  3. GC roots

    1.虚拟机栈(本地变量表)引用的对象 2.方法区静态属性引用的对象 3.方法区常量引用的对象 4.本地方法栈JNI(一般指naive方法)中引用的对象   常说的GC(Garbage Collecto ...

  4. JVM总括二-垃圾回收:GC Roots、回收算法、回收器

    JVM总括二-垃圾回收:GC Roots.回收算法.回收器 目录:JVM总括:目录 一.判断对象是否存活 为了判断对象是否存活引入GC Roots,如果一个对象与GC Roots没有直接或间接的引用关 ...

  5. 【JVM底层策略 一】GC roots如何判断对象不可达

    查找内存中不再使用的对象 引用计数法 引用计数法就是如果一个对象没有被任何引用指向,则可视之为垃圾.这种方法的缺点就是不能检测到环的存在. 2.根搜索算法 根搜索算法的基本思路就是通过一系列名为”GC ...

  6. JVM 垃圾回收GC Roots Tracing

    1.跟搜索算法: JVM中对内存进行回收时,需要判断对象是否仍在使用中,可以通过GC Roots Tracing辨别. 定义: 通过一系列名为”GCRoots”的对象作为起始点,从这个节点向下搜索,搜 ...

  7. 什么是GC Roots

    GC Root 2012年11月28日  ⁄ 综合 ⁄ 共 625字 ⁄ 字号  小 中 大  ⁄ 评论关闭   常说的GC(Garbage Collector) roots,特指的是垃圾收集器(Ga ...

  8. GC Roots的理解以及如何判断一个对象为“垃圾”

    http://blog.csdn.net/Great_Smile/article/details/49935307 这篇博客中讲解了哪些可以作为GC Roots以及如何判断一个对象为垃圾

  9. Java 虚拟机枚举 GC Roots 解析

    JVM 堆内存模型镇楼. 读<深入理解 Java 虚拟机>第三章GC算法,关于 GC Roots 枚举的段落没说透彻,理解上遇到困惑.因此对这点进行扩展并记录,发现国内各种博客写来写去都是 ...

随机推荐

  1. 基于注解风格的Spring-MVC的拦截器

    基于注解风格的Spring-MVC的拦截器 Spring-MVC如何使用拦截器,官方文档只给出了非注解风格的例子.那么基于注解风格如何使用拦截器呢? 基于注解基本上有2个可使用的定义类,分别是Defa ...

  2. ExtJS4.2学习(12)基于表格的右键菜单(转)

    鸣谢:http://www.shuyangyang.com.cn/jishuliangongfang/qianduanjishu/2013-11-24/181.html --------------- ...

  3. json分别算出元素的个数和最多的元素

    个数: var str = 'aaafsdsaaasasasasaa'; var json = {}; for (var i = 0; i < str.length; i++) { if(!js ...

  4. sort-based shuffle的核心:org.apache.spark.util.collection.ExternalSorter

    依据Spark 1.4版 在哪里会用到它 ExternalSorter是Spark的sort形式的shuffle实现的关键.SortShuffleWriter使用它,把RDD分区中的数据写入文件. o ...

  5. xcode 预编译头文件

    xcode 预编译头文件 cocos2d-prefix.pch  #import <Foundation/Foundation.h>

  6. Linux内核中的中断

    http://blog.csdn.net/weiqing1981127/article/details/8298585 中断处理程序是被内核调用来响应中断的,它运行在中断上下文,中断处理程序是上半部, ...

  7. Hibernate逍遥游记-第1章-JDBC访问数据库

    1. package mypack; import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.sw ...

  8. Android 动态Tab分页效果

    当前项目使用的是TabHost+Activity进行分页,目前要做个报表功能,需要在一个Tab页内进行Activity的切换.比方说我有4 个Tab页分别为Tab1,Tab2,Tab3,Tab4,现在 ...

  9. PC寄存器的真实状态

    因为预取指令的关系,PC寄存器永远比当前的寄存器多两个指令,ARM模式为大8,Thumb模式为大2,这针对的是32bit的ARMv7的指令集 In ARM state, the value of th ...

  10. 中文编码之GB2312,Big5,GBK简介

    汉字编码中现在主要用到的有三类,包括GBK,GB2312和Big5. 1.GB2312 又称国标码,由国家标准总局发布,1981年5月1日实施,通行于大陆.新加坡等地也使用此编码.它是一个简化字的编码 ...