Reputation: 5963
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?
Upvotes: 3
Views: 687
Reputation: 3890
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
Upvotes: 3
Reputation: 11139
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.
Upvotes: 2