Copy link to clipboard
Copied
I'm having what strikes me as a stupid problem, but I can't figure it out myself... it could be a subtle nuance of Flash or just some knowledge I don't have, anyway... I'm making a Flash game with a main menu and multiple levels. We didn't organize our project right (just self-taught college students doing it in our free time) so we made a level before the main menu. I ended up putting the entire level, code and all, into a MovieClip. It creates an instance of that MC when you start a level (I'm sure this was a terrible idea).
But it leaks when I delete the MovieClip and create a new one (i.e. quit the level to the main menu and then start it again). It originally leaked ~6MB each time you quit and started it again, but I've tightened it up to ~1MB, but I'd still like to fix that.
I know to Garbage Collect something you have to remove references, so I've
I've only used weak-referenced events, and I've removed all of them anyway, but it's still leaking. There's way too much code for me to post all of it, so I guess I'm just wondering if anyone has any general ideas I haven't thought of.
Copy link to clipboard
Copied
Hello,
#1
if there is BitmapData instance somewhere call dispose() on it and then nullify:
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/display/BitmapData.html#dispose()
#2
if there is XML data involved you could use flash.system.System.disposeXML():
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/system/System.html#disposeXML()
In both there is not enough to nullify them for immediate gc I think.
regards,
Peter
Copy link to clipboard
Copied
Thanks, but I don't have either of those things in the project.