i noticed that i'm using nearly 93% of Memory under "full load" (my highest Memory consumption mode).
My first Question I'm using a lot of drawables, relatively small. I Cache them with a LRUCache and for sure i free the LRUCache if something is in there no longer needed anymore. Is 93% at start up way to much or a normal behaviour of the heap that he allocates that much Memory?
After Rotation i noticed that the heap is increasing and logically my Memory consumption(percantage) is decreasing.
Why does this happen? I do nearly exactly the same, i'm only using a Little bit more of Memory.
After one rotation
I have no Memory leak, at least no one which is big enough that i'm able to notice. The heap consumption is always oscillating in a range of 2-4%.
Best How To :
When you rotate image, underlying software would probably use rotation matrix to do this for you. This is extra amount of memory that must be put into heap just for a while. However if there is no enough continous space in the heap, JVM would increase heap size to fit your extra data. When all references to that data are lost, then GC silently releases this memory, but the heap size remains the same for future use. This is because use of memory already allocated by operating system is usually faster, then releasing memory pages and requesting new from OS every a while. Actually Java has heuristics that tell it when to decrease heap size, e.g., after a period of time, when most of the heap is not used.
Here you can find some options that control (Oracle) Java heuristics. I believe some of them would also work for Android Dalvik JVM.