hushaojie04 / libgdx

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

Bug in Livewallpaper test #1132

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
This happens with the Livewallpaper.java in libgdx tests.

Everytime I enter Settings - Display - Wallpapers - Home screen wallpaper - 
Live wallpapers - MyWallPaper -> A new instance of the wallpaper is created. 
The old instances don't seem to get destroyed. This happens with the 
Livewallpaper.java in libgdx tests. The end result is that the wallpaper takes 
more and more memory, which does not seem to get released.

The following is taken by "Dump HPROF file" in eclipse after visiting few times 
the menu:

8 instances of "com.badlogic.gdx.tests.WaterRipples", loaded by 
"dalvik.system.PathClassLoader @ 0x405153d0" occupy 1 347 200 (36,45%) bytes. 

Biggest instances:
•com.badlogic.gdx.tests.WaterRipples @ 0x40514028 - 168 400 (4,56%) bytes. 
•com.badlogic.gdx.tests.WaterRipples @ 0x40526ac0 - 168 400 (4,56%) bytes. 
•com.badlogic.gdx.tests.WaterRipples @ 0x40529ed8 - 168 400 (4,56%) bytes. 
•com.badlogic.gdx.tests.WaterRipples @ 0x40583040 - 168 400 (4,56%) bytes. 
•com.badlogic.gdx.tests.WaterRipples @ 0x405c3748 - 168 400 (4,56%) bytes. 
•com.badlogic.gdx.tests.WaterRipples @ 0x40604878 - 168 400 (4,56%) bytes. 
•com.badlogic.gdx.tests.WaterRipples @ 0x40643bd0 - 168 400 (4,56%) bytes. 
•com.badlogic.gdx.tests.WaterRipples @ 0x40687870 - 168 400 (4,56%) bytes. 

These instances are referenced from one instance of 
"java.util.HashMap$HashMapEntry[]", loaded by "<system class loader>"

Keywords
com.badlogic.gdx.tests.WaterRipples
dalvik.system.PathClassLoader @ 0x405153d0
java.util.HashMap$HashMapEntry[]

Original issue reported on code.google.com by indiumin...@gmail.com on 16 Nov 2012 at 5:16

GoogleCodeExporter commented 9 years ago
Can you share more information about the device you are using to test this and 
the Android version?

Original comment by ariel.co...@gmail.com on 24 Nov 2012 at 9:47

GoogleCodeExporter commented 9 years ago
Ok, I reproduced the bug on my Galaxy S with Android 2.3.6 with the nightlies.

Original comment by ariel.co...@gmail.com on 25 Nov 2012 at 11:42

GoogleCodeExporter commented 9 years ago
The problem is the commented row in the AndroidLiveWallpaperService.java

// app.onDestroy()

but if we use it we have some other problem.

I have workaround, it is kill the app if we change the wallpaper at least:

if (runningEngines == 0) {
   app.onDestroy();
}

Original comment by matthe...@gmail.com on 26 Nov 2012 at 8:55

GoogleCodeExporter commented 9 years ago
Arielsan: I have the same phone and same version of Android than you.
Matthew: Nice suggestion.

Original comment by indiumin...@gmail.com on 26 Nov 2012 at 10:17