1
python | 分代回收
source link: https://benpaodewoniu.github.io/2022/12/29/python186/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
python | 分代回收
上一次标记清除遗留了两个问题。
- 什么时候扫描
- 扫描一次的代价可能很大
将可能存在循环引用的链表分成了 3 层「3 个链表」。
- 0代
0
代对象个数达到700
个扫描一次
- 1代
0
代如果扫描10
次,1
代扫描1
次
- 2代
1
代如果扫描10
次,2
代扫描1
次
最开始放在 0
代,如果第一次扫描,发现不是垃圾,进行升级,升级到 1
代。
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK