So I'm working on a puzzle game in flash. For all intents and purposes it's like Tetris. I spawn blocks, they move around the screen, then they get destroyed and disappear. I was having some trouble with the memory usage being too high over time so I read up on memory management and I think I have that figured out now. It's definitely climbing slower than it was before, but the framerate is still taking a huge dive after playing for a while. If it's not a memory leak what else could be causing this? Thanks in advance.
Either 2 of these it think:
- It would very well be that you are deleting stuff from the display-list but still have references in other places( like arrays ) that are still being processed. This keeps building up and completely hogs your game. ( but Flash can easily handle tons of objects )
-Your algorithm, even though simplistic, is flawed and is doing more work than necessary. Memory leaks are nearly impossible in AS3 unless you loose an object that holds a reference to an object you can't reach anymore ( like Events that aren't destroyed and never have their weak flag set to true).
This combined with the above one can really tear down the performance.
http://gamedev.michaeljameswilliams.com/2009/03/25/avoider-game-tutorial-12/ you should visit this part of that tutorial, it will probably contain your problem, which is for example, not unloading the childs you create and instead just freeze them out of view. I could try to tell you details but check that out, at least you should get a lot of really useful tips.