I'm facing some troubles with memory consumption while developing 2D game using libGDX.
It's a 2D game with rich graphic content - there are many textures, animations, fonts etc. For some reasons all graphic content is loaded on game start - and here is a problem with memory. I've tested memory allocation (native & heap) on different devices and got different results: (I've divided all devices for groups by textures sizes)
Group 1 (textures adopted for ~840*480 screens)
HTC Desire (Froyo): 178Mb(native) - 12Mb(heap) - application loads successfully
HTC One V (ICS): 30Mb(native) - 12Mb(heap) - application loads successfully
HTC Desire S (Jelly Bean): 30Mb(native) - 12Mb(heap) - application loads successfully
Group 2 (textures adopted for ~1366*768 screens)
Samsung(Google) Galaxy Nexus 329Mb(native) - 18Mb(heap) - works perfectly
Galaxy TAB (Honeycomb) 164Mb(native) - 10Mb(heap) - application crashes (Surface.OutOfResouresException).
I think there could be some significant memory management difference on all android versions, which brings me these troubles.
Can anyone explain what exactly happens while loading textures on android 3.x? Or maybe post some links to understand what need to be done to resolve this problem.
SOME UPDATE
Toady I'd made some additional tests on 3.x emulators (I know this is not best way, but logs was similar on emu and Galaxy Tab before)
- I've run game with textures adopted for 1024*600 - app crashes on 80% loading resources (158 native memory allocation)
- With textures for 800*480 - app crashes on 100% loading (145Mb native memory allocation)
And finally I have run app on new Google Nexus tablet (Jelly Bean) which uses same textures as 3.x tablets (1280*800px) - ~30Mb native memory and ~12Mb vm heap.
Now I completely lose understanding of what's going on - same memory allocation for textures 800*480 and 1280*800...
FINALLY
I have been resolve this situation using load resources on demand with some progress bar. After all attemptions I have no found another way.