Reputation: 93
I'm developing a Game for Android with LibGDX. If i start my Game it work but i Debug the Memory Usage with this Methods
Gdx.app.log("Java Heap", String.valueOf(Gdx.app.getJavaHeap()));
Gdx.app.log("Native Heap", String.valueOf(Gdx.app.getNativeHeap()));
The Java Heap is constant but the Native Heap climb in the high. I do 15-20 actions on the screen with Textbutton, labels ect. and import .png files for the images. I dipose this files with the dispose() Method but the Native Heap climb higher and i dont know what fill the Memory.
Now is my question give it a way to Debug what is in the Memory Usage or give it a way to clear all Native Heap out of dispose() ? If anyone now a way to help please tell it.
Upvotes: 2
Views: 1054
Reputation: 749
The way i try to optimize game using eclipse for android is through DDMS
. There are two key tabs, HEAP
and ALLOCATION TRACKER
.
Heap
will let you know how much heap memory is consumed at that moment of time.
Allocation Tracker
will keep track of memory allocation, as well as the class stack trace of who is allocating that memory.
Also one golden rule, Never ever create new objects in render method.
Upvotes: 2