MrLoick / flixel-android

Automatically exported from code.google.com/p/flixel-android
Other
0 stars 0 forks source link

Huge performance drop on the phone, because the Pixmap are not disposed #24

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Run heavy demos like Particles, Mode, FlxCollision, CollisionDemo
2. It'll drop to 9-20 fps.

Expected output
Runs smooth between 50-60 fps depending on which demo is running.

Actual output
Huge fps drops when a lot of objects are on screen.

Please use labels and text to provide additional information.
FlxG::addBitmap() and FlxG::createBitmap()
A Pixmap is created but not disposed. It even got cached in the FlxAssetCache.

Pixmap resides in native heap memory it must be disposed of by calling 
dispose() when no longer needed to prevent memory leaks.
http://code.google.com/p/libgdx/wiki/GraphicsPixmap

When I disposed the Pixmap, the demos runs on normal again (60fps).
However, Mode won't be runnable in PlayState.

Original issue reported on code.google.com by kawingc...@gmail.com on 31 Aug 2012 at 1:13

GoogleCodeExporter commented 8 years ago

Original comment by kawingc...@gmail.com on 31 Aug 2012 at 1:15

GoogleCodeExporter commented 8 years ago
I'm not at my computer to check, but I think the reason pixmaps aren't disposed 
in createBitmap() is so that they can be reloaded after context loss (such as 
the user pressing the home button). The pixmaps are instead disposed when a 
state is switched. This issue will be difficult for me to investigate because 
the demos already run at 60 fps on my phone (sgs2). Can you confirm that 
ParticlesDemo goes from ~10 fps to ~60 fps  just by disposing the pixmaps in 
createBitmap()? The only pixmaps that should be created are two small particles 
which would take up very little memory.

Original comment by TSWes...@gmail.com on 31 Aug 2012 at 9:44

GoogleCodeExporter commented 8 years ago
There was a bug in the older version of libgdx. Version 0.9.6 fixes the 
performance.
Particle demo issue still occurs.

Original comment by kawingc...@gmail.com on 1 Sep 2012 at 12:08

GoogleCodeExporter commented 8 years ago
The FlxG::createBitmap() issue continuous here: 
http://code.google.com/p/flixel-android/issues/detail?id=27

Original comment by kawingc...@gmail.com on 11 Sep 2012 at 5:09