Memory deallocation in WCK

Anyone have an idea where I need to be scraping around to find where memory would not be getting deallocated when I unload a WCK swf? I seem to have about 28-33MB in my game hanging around whenever I unload the game. Everytime I consecutively load and unload the game, i get the same leftover amount compounding.

I could really use some help figuring out where this memory culprit is hiding out. I believe I've already ruled out any chance that cacheAsBitmap was holding things back. I removed every cached object I had in the current frame I was loading up and while I had less total memory, when I unloaded practically the same amount was left.

Thanks in advance.
Here's a screenshot of my profiling in Flash Builder through a wrapper document class. This allows me to load and unload it.

Image

I'm seeing from some other posts that AlchemyYield and CRunner seem to be the most likely culprits that are still active. I see their numbers consistently rising during the function of the application.

I'm trying to find some clarity on where exactly this stuff is happening, but I think it's on the C++ side of things, which I'm not totally familiar with, but feel like I'm about to have a long week trying to diagnose.
I see your post here Jesse, 🙂 Let me know if you got any clarity on it. The project I'm on we'd rather just run the whole thing from one instance of WCK, but the size of our levels compels us to group things into large clumps that are really about as much as Flash can handle at once.

http://forums.adobe.com/thread/755299?tstart=0
I haven't heard anything. I don't think there's a solution.

Maybe you can jump between different SWFs outside of Flash, like a new page request or via javascript or something. Basically, get the SWF out of the browser and fetch a new one This means you're reloading the entire WCK library with each "chunk" but it sounds like your asset size is the problem anyway, so maybe that's ok. No idea what environment you're publishing in tho', so maybe that's not possible.
Thanks for the reply. Man, that really sucks.

Any other ideas about how I somehow decouple WCK from the rest of it all? I'm sort of at a loss on what to do. I tried to look through your C code but I didn't understand things well enough to definitely make any headway. We were trying to find a place where a final AS3_Release might sort of put an end to it all. I don't see like a global call to this, but I do see it for some of the individual Box2D components.

We have been loading through a higher up Flash layer. The ExternalInterface.call/javascript was one of our first ideas, but wanted it to be one of our last options. Considering we're loading something akin to a Super Mario World "world" comprised of different zones in each file, it's not too far off of what we're doing now. It's also not that different from what a kid's game like Poptropica does when it loads different areas.

Thanks again Jesse. Your help has been invaluable.
So this is a total hack, but ended up helping me reclaim every last bit of memory in between "zones" (frames) of our level. I haven't done extensive testing loading/unloading, but the numbers when I move back and forth are practically identical to what they were the moment before.

Code:
try {
     new LocalConnection().connect('foo');
     new LocalConnection().connect('foo');
} catch (e:*) {}
// the GC will perform a full mark/sweep on the second call.


Like I said, this is a total hack, but it worked for me. I also looked at Grant's reservations and checked my processor usage. If you're not calling this every frame, I don't see it being a problem. I tried to look at it while this was happening, and if anything, processor usage went down (I rigged it up to a button and basically stared at Activity Monitor).
http://gskinner.com/blog/archives/2006/08/as3_resource_ma_2.html

Original thread: https://box2d.org/forum/viewtopic.php?t=6419