Premature unloading of loaded SWFs

I have an AS3 Flash project that loads a bunch of movies from external SWF files. When I run in it inside the Flash CS3 Debug Movie debugger, I see an odd thing. I see it load and unpack the SWFs. After loading the loader and movieclips are stored in an array in a class that lives as long as the document root class. In other words, there are active references to these loaded movieclips, so the garbage collector should not be able to free the memory. Yet after doing some quick loop over the loaded SWFs, it process the first 3 out of 22 and then in the output window the debugger shows me it begins unloading the other 19 SWFs.

One of the first lessons I learned when writing non-trivial as3 was to ensure I had references to instances I required stored somewhere that would not go out of scope and potentially trigger GC. But today I started seeing this odd behavior.

As an additional note, when this starts happening the debugger seems to get a little wiggy. For example it will not stop at breakpoints set on trace statements that ARE printing to the output window.

I must have angered the Flash memory management gods in some bad way. There is most likely a bug in my code but if this situation stirs any thoughts fire off this way!

:write: