Files
Hui-s-notebook/可达性分析算法.md
2023-09-10 10:50:53 +08:00

10 lines
956 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
JavaC#Lisp使用该算法
>通过一系列称为**GC Roots**的根对象作为起始节点集,从这些节点开始,根据引用关系向下搜索,搜索过程所走过的路径称为**引用链**Reference Chain如果某个对象到GC Roots间没有任何链引用时图论上从GC Roots到该对象不可达时证明该对象不可能再被使用
可作为GC Roots的对象
1. 方法区中类静态属性引用的对象如Java类的引用类型静态变量
2. 方法区中常量引用的对象如字符串常量池String table引用的对象
3. 本地方法栈中JNINative方法引用的对象
4. Java虚拟机内部的引用如基本数据类型对应的Class对象一些常驻的异常对象NullPointExceptionOutOfMemoryError系统类加载器
5. 所有被同步锁Synchorinzed持有的对象
6. 反映虚拟机内部情况的JMXBeanJAMTI中注册的回调本地代码缓存等