Memory Leak?

Hello,

I’ve been working on a flash game, and it has a problem. The game runs at full FPS within the first few minutes of opening, but after about 10 minutes of play, its FPS is low enough to make the entire game useless.

Using this tool, I found that there is a constant upward trend in System.totalMemory. The sawtooth-graph associated with garbage collection is shown, but the area under the teeth constantly increases. I’ve found that the game’s slowness occurs when the memory usage reaches about 100 MB.

Is this, for sure, a memory leak? I’ve looked through all of my code for anything that could cause a memory leak, but I’m unable to find any unclosed references, and all my event listeners are weak references. Is there any way to trace the cause of a memory leak?

[SIZE=1]More information about the structure of the game:
There is a main menu and a game screen. The game screen is programatically added to the stage when a button on the menu is pressed. After the level ends, the game screen is removed from the stage, and the main menu is added to the stage. The game screen is re-added when the next level starts. Theoretically, the entire game screen should be garbage collected each time it is removed, thus freeing memory for the next time it is added.[/SIZE]

I’ve been working on this game for over a year, and this could destroy it all. :cry3: Your help is appreciated!