0

I cant seem to understand why my app is taking 33mb of memory.(Just added up nativeprivate dalvikprivate)

Is there anyway to check at runtime what memory is allocated but waiting to be GC and which cannot be GC and is a leak.

Is it a viable option to call system.gc every 30 sec ?

What is the memory utilization of a n activity with simple hello world text. => In my case I am getting 6mb. Why Cant it be a few KB's How to keep the memory requirement to minimum

  • no you should not use `System.gc()`. you can anable proguard. But you need to wrtie your code such that you avoid memory leaks – Raghunandan Jun 28 '13 at 11:19
  • http://developer.android.com/tools/help/proguard.html. you can use mat as suggested by commonsware. look at the last part of this video https://www.youtube.com/watch?v=_CruQY55HOk – Raghunandan Jun 28 '13 at 11:27
  • How Can my app be small little app that uses <2mb of memory. How to achieve that. 2MB is a big amount for an app tht uses 2 activities without much of graphics. PS: I come from embedded domain where 500k is a big memory chunk –  Jun 28 '13 at 12:48

1 Answers1

3

Just added up nativeprivate dalvikprivate

You might as well use a random number generator. Android's memory management is significantly more complicated than that.

Is there anyway to check at runtime what memory is allocated but waiting to be GC and which cannot be GC and is a leak.

You can use MAT to learn what objects are ineligible for GC, so you can try to determine if you are leaking memory.

Community
  • 1
  • 1
CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • Just checked my code. There are a few places where I create a ArrayList of 50 items every 20secs. Everytime I do a new, the objects are a candidate for GC but if GC runs after android_decided_time, my app would just wastes memory without actually leaking it. I did some programs slowing down because of this, till I killed my app and they were running smooth. Android GC was not called for my app till it was <35Mb –  Jun 28 '13 at 12:47