Delaying destructors and GC
还没有人认领这个 Issue。
- 主要语言
- C
- 星标
- 40.4k
- 派生
- 8.2k
- 平均合并
- 2 天 13 小时
- 30 天内合并 PR
- 96
描述
Description
Due to destructors and the cycle collector, zval_ptr_dtor() may have more effects than just freeing the given zval. This is the cause of bugs and workarounds.
These bugs and workarounds could be avoided by delaying destructors and GC runs until a safepoint is reached. If we use vm interrupts as safepoints, this would delay destructors until the next branch/loop or function call (this should be defined more precisely), which seems reasonable.
I'm creating this ticket to aggregate issues that would not exist with delayed destructors and GC runs:
- 3d2b1753393b
- 6f38acfaf906
- https://bugs.php.net/bug.php?id=71020
- https://bugs.php.net/bug.php?id=73423
- https://github.com/php/php-src/issues/10168
- https://github.com/php/php-src/issues/13612
- https://github.com/php/php-src/issues/16464
- https://github.com/php/php-src/issues/16478
- https://github.com/php/php-src/issues/16479
- https://github.com/php/php-src/issues/16646
- https://github.com/php/php-src/issues/17162
- https://github.com/php/php-src/issues/18209
- https://github.com/php/php-src/issues/19999
- https://github.com/php/php-src/issues/20405
- https://github.com/php/php-src/issues/20477
- https://github.com/php/php-src/issues/20657
- https://github.com/php/php-src/issues/21824
- https://github.com/php/php-src/issues/22061
- https://github.com/php/php-src/issues/22062
https://github.com/php/php-src/pull/19787 delays GC runs, but not destructors.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 zval_ptr_dtor() 和 VM-interrupt/safepoint 讨论开始,然后比较 pull request 19787;该 pull request 会延迟 GC 运行,但不会延迟析构函数。要完成这项工作,需要定义明确的 safepoint 策略,并完成能够处理 issue 中列出的汇总案例的实现。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- c, php
- 领域
- compilers
- Issue 类型
- 功能
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 20/100