Flash/ActionScript 内存碎片
除了标记和清除之外,.Net 和 Java 的垃圾收集器还运行压缩阶段以减少内存碎片。 我无法找到有关 Flash 9 垃圾收集器的压缩/碎片整理阶段的任何文档 - Flash 没有任何压缩阶段吗?
In addition to mark-and-sweep, the garbage collectors for .Net and Java both also run a compaction phase to cut down on memory fragmentation. I am not able to find any documentation on a compaction/defragmentation phase for the Flash 9 garbage collector - does Flash not have any compaction phase?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Adobe 在 Flash 中使用的 AS3 虚拟机是开源的。
http://www.mozilla.org/projects/tamarin/
虚拟内存管理器名为 MMgc 的机器包含在该源代码中。
MMgc提供非移动收集器; 一旦分配,对象就不会被收集器移动。 这意味着不存在压缩阶段。
有关 MMgc 的更多文档可在此处找到:
https://developer.mozilla.org/en/mmgc
一些最近的工作记录在源存储库的文档目录中:
http ://hg.mozilla.org/tamarin-redux/file/tip/doc/mmgc
The virtual machine for AS3 that Adobe uses in Flash is open-source.
http://www.mozilla.org/projects/tamarin/
The memory manager for the virtual machine, called MMgc, is included in that source code.
MMgc provides a non-moving collector; once allocated, objects are not moved around by the collector. This implies there is no compaction phase.
Further documentation on MMgc is available here:
https://developer.mozilla.org/en/mmgc
Some of the more recent work is being documented within the source repository's documentation directory:
http://hg.mozilla.org/tamarin-redux/file/tip/doc/mmgc
嗯,我对内存管理问题相当深入,并且与 Adobe 工程师讨论过这个问题,但我从未听说过碎片整理阶段。 另一方面,他们似乎不太可能将其遗漏,而且我确实看到 GC 之后我的整体内存使用量下降了,就像在碎片整理阶段时您所期望的那样。 所以总的来说我想说可能有这样一个阶段。
但我确实感到相当有信心的是,我认为无论如何都没有任何官方公开文档。 无论如何,我当然从未见过。 如果有人知道,我会很乐意撤销,但以防万一您没有得到任何其他答案。
Well, I've been fairly deep into memory management issues and I've talked to Adobe engineers about it, and I never heard any mention of a defrag phase. On the other hand, it seems reasonably unlikely that they'd leave it out, and I've certainly seen my overall memory use drop after a GC, in the sort of way you'd expect it to if there was a defrag phase. So overall I'd say there probably is such a phase.
But what I do feel fairly confident about is that I don't think there's any official public docs on it either way. I certainly never saw any, anyhow. If anyone knows otherwise I'll happily rescind, but just in case you don't get any other answers.