3

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?

Not Sure
  • 5,415
  • 3
  • 20
  • 28

2 Answers2

3

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

pnkfelix
  • 3,505
  • 26
  • 45
2

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.

fenomas
  • 11,128
  • 1
  • 30
  • 53