VancouverEngineer / andengine

Automatically exported from code.google.com/p/andengine
0 stars 0 forks source link

Memory leak in BufferObjectManager #39

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Run an AndEngine application. Note the heap size with for example ddms.
2. Re-run it. Note the heap size. the heap grows for each run of the 
application.

An analysis with MemoryAnalzyer reveals the culprit: BufferObjectManager.

Solution:
Maybe add BufferObjectManager.getActiveInstance().clear() in onDestroy() of the 
base activity.
The problem is the references that this singleton retains.
Clearing them fixes the leak.

Original issue reported on code.google.com by adam.waldenberg@gmail.com on 10 Jul 2011 at 2:58

GoogleCodeExporter commented 8 years ago
Oh.. I see that the BufferObjectManager instance actually now part of Engine.

I guess the problem actually is the static lists at the top of 
BufferObjectManager. So I guess clearing them as above would solve it... or 
simply make them non-static.

Original comment by adam.waldenberg@gmail.com on 10 Jul 2011 at 3:46