I currently have a blank LibGDX application that does nothing. It does not render anything, nor does it update anything. It is just an empty Screen. When I deploy the application to android I am greeted with some horrifying memory consumptions. Using DDMS I create the following heap dump when the application is running on my device:
The most significant use of memory is the 13.163 MB 1-byte array allocation. Isn't this half the heap?!
I checked the allocations and saw that nothing was pointing being allocated of that size:
Now using Eclipse MAT I analyse the heap dump:
So the high use of memory is still coming from byte[] arrays.
Analyzing the byte[] section further I come up with this:
I now see the huge byte[] allocations are coming from the android graphics. I'm not even drawing anything! Is there any way I can avoid having the android graphics portion of this app take up half of the heap. This just causes excess garbage collection to happen when things are actually going on, or is this normal and I just have to deal with it?
Note: I am running this on a Samsung Galaxy S4 with libGDX version 1.4 (or whatever the latest version is)
UPDATE: I have no discovered that the 14-13MB byte array allocation is normal for applications but I still have a problem. My heap size is too small. If the android graphics take up half of my heap I have little room for anything useful and the garbage collector goes crazy. On another application I created with an older version of libgdx (An undeniably more poorly coded application) and the heap size is 73 Mb. How can I increase the heap size? I presume 73 Mb is fairly large and as you can see most of it is not used. Here are the older application's heap statistics: