| |||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
原始链接: https://news.ycombinator.com/item?id=43893581
一个Hacker News帖子讨论了Chromium中发现的一个与JavaScript的FinalizationRegistry API相关的bug。由于依赖垃圾回收,该API被认为比较棘手且可能不可靠。bug修复涉及确保标志`is_finalization_registry_cleanup_task_posted_`被正确重置,以防止跳过清理任务。用户表达了对依赖垃圾回收执行关键任务的担忧,并建议使用替代的内存管理方法,例如带有明确大小限制的池或arena。 一位用户分享了其提交与窗口打开行为更改相关的Chromium bug的经验,强调了Chromium团队的bug识别和修复流程的积极体验。讨论还涉及自动化更广泛的社会影响以及潜在的失业问题,尤其是在建筑行业,原发帖人公司为砌砖行业制造机器人。一些人认为自动化可以提高危险工作的安全性,而另一些人则担心失业率上升。
| |||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
>Avoid where possible
>Correct use of FinalizationRegistry takes careful thought, and it's best avoided if possible. It's also important to avoid relying on any specific behaviors not guaranteed by the specification. When, how, and whether garbage collection occurs is down to the implementation of any given JavaScript engine. Any behavior you observe in one engine may be different in another engine, in another version of the same engine, or even in a slightly different situation with the same version of the same engine. Garbage collection is a hard problem that JavaScript engine implementers are constantly refining and improving their solutions to.
Kinda tricky API
reply