博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Object Death in Garbage Collector's Perspective
阅读量:4992 次
发布时间:2019-06-12

本文共 1436 字,大约阅读时间需要 4 分钟。

Our program can directly access values stored in three locations - registers, stack (including local variables and temporary variables) and global variables. References stored in these locations are the so-called root set. For the memory allocated dynamically, it can only be accessed from root set or reference chains from root set. The precondition is, the program cannot access any random location in its address space.

By the time an object becomes unreachable by user program, it dies. That means the object is no longer in use by program and cannot be accessed by program from root set. Therefore the object is called garbage and will be reclaimed by collector. The memory that occupied will be returned to the heap.

The object death is actually caused by pointer update. All of the pointer update events can be divided into three simple cases.

  • In object graph (1), for object a, if the only incoming reference to object a is broken, then a dies immediately.
  • In object graph (2), for object c, it has only one incoming reference from object b. In this case, if the incoming reference to object b is broken, then c and b die immediately with object b’s death.
  • In object graph (3), for object e and f, they both can be only reached from object d. In this case, if the incoming reference to object d is broken, then d dies. Immediately, object e and f die too.

<EOF>

转载于:https://www.cnblogs.com/rmcary/archive/2012/11/28/2793323.html

你可能感兴趣的文章
js题集29--部分题目在线答题链接地址
查看>>
PCLint 帮助中关于如何获得gcc/g++编译宏定义和头文件搜索目录的方法说明
查看>>
依赖注入模式
查看>>
Backbone.js之Todo源码浅析
查看>>
传统软件企业之殇
查看>>
[bzoj4491]我也不知道题目名字是什么
查看>>
CSS pusle雷达动画实现
查看>>
【问题解决方案】之 Word 公式编辑器 使用小tips
查看>>
模拟凡客导航
查看>>
BZOJ4804: 欧拉心算
查看>>
sublime text 3中安装ctags支持函数跳转,安装convertToUtf8支持中文步骤[工具篇]
查看>>
静态类和单例模式区别
查看>>
团队冲刺第一天
查看>>
二分查找法查找数组元素下表
查看>>
第四章 数据类型
查看>>
php-cgi.exe
查看>>
5.7 Windows常用网络命令
查看>>
防抖(Debouncing)和节流(Throttling)
查看>>
SQL Server 查询当前行、上一行、下一行合并查询
查看>>
Python 学习笔记之——用 sklearn 对数据进行预处理
查看>>