title: How to find if my app use more memory than optimal?
body: <p>My app is playing video clips and continues audio playback after going to background.</p>
  
  <pre><code>Applications Memory Usage (kB):
  Uptime: 2572430 Realtime: 2572430
  
  ** MEMINFO in pid 11771 [bigdig.yarh.ellotv.activitytry] **
                           Shared  Private     Heap     Heap     Heap
                     Pss    Dirty    Dirty     Size    Alloc     Free
                  ------   ------   ------   ------   ------   ------
         Native       20       12       20   167508   126691      120
         Dalvik    46565    11536    46336    50932    45645     5287
         Cursor        0        0        0                           
         Ashmem        0        0        0                           
      Other dev       52       56        0                           
       .so mmap     3145     2536     1012                           
      .jar mmap        0        0        0                           
      .apk mmap     1269        0        0                           
      .ttf mmap       46        0        0                           
      .dex mmap     5018        0       84                           
     Other mmap    20096    32836     2784                           
        Unknown   125113      260   125112                           
          TOTAL   201324    47236   175348   218440   172336     5407
  
   Objects
                 Views:      643         ViewRootImpl:        1
           AppContexts:        5           Activities:        2
                Assets:       63        AssetManagers:       63
         Local Binders:       17        Proxy Binders:       26
      Death Recipients:        1
       OpenSSL Sockets:        7
  
   SQL
           MEMORY_USED:      160
    PAGECACHE_OVERFLOW:       17          MALLOC_SIZE:       62
  
   DATABASES
        pgsz     dbsz   Lookaside(b)          cache  Dbname
           4       40             20         0/15/1  /data/data/bigdig.yarh.ellotv.activitytry/databases/webview.db
  
   Asset Allocations
      zip:/data/app/bigdig.yarh.ellotv.activitytry-1.apk:/assets/fonts/ubuntu_r.ttf: 346K
      zip:/data/app/bigdig.yarh.ellotv.activitytry-1.apk:/assets/fonts/ubuntu_r.ttf: 346K
      zip:/data/app/bigdig.yarh.ellotv.activitytry-1.apk:/assets/fonts/ubuntu_l.ttf: 406K
      zip:/data/app/bigdig.yarh.ellotv.activitytry-1.apk:/assets/fonts/ubuntu_r.ttf: 346K
      zip:/data/app/bigdig.yarh.ellotv.activitytry-1.apk:/assets/fonts/ubuntu_l.ttf: 406K
      zip:/data/app/bigdig.yarh.ellotv.activitytry-1.apk:/assets/fonts/ubuntu_r.ttf: 346K
      zip:/data/app/bigdig.yarh.ellotv.activitytry-1.apk:/assets/fonts/ubuntu_l.ttf: 406K
      zip:/data/app/bigdig.yarh.ellotv.activitytry-1.apk:/assets/fonts/ubuntu_r.ttf: 346K
      zip:/data/app/bigdig.yarh.ellotv.activitytry-1.apk:/assets/fonts/ubuntu_r.ttf: 346K
      zip:/data/app/bigdig.yarh.ellotv.activitytry-1.apk:/assets/fonts/ubuntu_r.ttf: 346K
      zip:/data/app/bigdig.yarh.ellotv.activitytry-1.apk:/assets/fonts/ubuntu_r.ttf: 346K
      zip:/data/app/bigdig.yarh.ellotv.activitytry-1.apk:/assets/fonts/ubuntu_r.ttf: 346K
      zip:/data/app/bigdig.yarh.ellotv.activitytry-1.apk:/assets/fonts/ubuntu_r.ttf: 346K
      zip:/data/app/bigdig.yarh.ellotv.activitytry-1.apk:/assets/fonts/ubuntu_r.ttf: 346K
      zip:/data/app/bigdig.yarh.ellotv.activitytry-1.apk:/assets/fonts/ubuntu_r.ttf: 346K
      zip:/data/app/bigdig.yarh.ellotv.activitytry-1.apk:/assets/fonts/ubuntu_r.ttf: 346K
      zip:/data/app/bigdig.yarh.ellotv.activitytry-1.apk:/assets/fonts/ubuntu_l.ttf: 406K
      zip:/data/app/bigdig.yarh.ellotv.activitytry-1.apk:/assets/fonts/ubuntu_r.ttf: 346K
      zip:/data/app/bigdig.yarh.ellotv.activitytry-1.apk:/assets/fonts/ubuntu_l.ttf: 406K
      zip:/data/app/bigdig.yarh.ellotv.activitytry-1.apk:/assets/fonts/ubuntu_r.ttf: 346K
      zip:/data/app/bigdig.yarh.ellotv.activitytry-1.apk:/assets/fonts/ubuntu_l.ttf: 406K
      zip:/data/app/bigdig.yarh.ellotv.activitytry-1.apk:/assets/fonts/ubuntu_r.ttf: 346K
      zip:/data/app/bigdig.yarh.ellotv.activitytry-1.apk:/assets/fonts/ubuntu_l.ttf: 406K
      zip:/data/app/bigdig.yarh.ellotv.activitytry-1.apk:/assets/fonts/ubuntu_r.ttf: 346K
      zip:/data/app/bigdig.yarh.ellotv.activitytry-1.apk:/assets/fonts/ubuntu_l.ttf: 406K
      zip:/data/app/bigdig.yarh.ellotv.activitytry-1.apk:/assets/fonts/ubuntu_r.ttf: 346K
      zip:/data/app/bigdig.yarh.ellotv.activitytry-1.apk:/assets/fonts/ubuntu_l.ttf: 406K
      zip:/data/app/bigdig.yarh.ellotv.activitytry-1.apk:/assets/fonts/ubuntu_r.ttf: 346K
      zip:/data/app/bigdig.yarh.ellotv.activitytry-1.apk:/assets/fonts/ubuntu_l.ttf: 406K
      zip:/data/app/bigdig.yarh.ellotv.activitytry-1.apk:/assets/fonts/ubuntu_r.ttf: 346K
      zip:/data/app/bigdig.yarh.ellotv.activitytry-1.apk:/assets/fonts/ubuntu_l.ttf: 406K
      zip:/data/app/bigdig.yarh.ellotv.activitytry-1.apk:/assets/fonts/ubuntu_r.ttf: 346K
      zip:/data/app/bigdig.yarh.ellotv.activitytry-1.apk:/assets/fonts/ubuntu_l.ttf: 406K
      zip:/data/app/bigdig.yarh.ellotv.activitytry-1.apk:/assets/fonts/ubuntu_r.ttf: 346K
      zip:/data/app/bigdig.yarh.ellotv.activitytry-1.apk:/assets/fonts/ubuntu_l.ttf: 406K
      zip:/data/app/bigdig.yarh.ellotv.activitytry-1.apk:/assets/fonts/ubuntu_r.ttf: 346K
      zip:/data/app/bigdig.yarh.ellotv.activitytry-1.apk:/assets/fonts/ubuntu_l.ttf: 406K
      zip:/data/app/bigdig.yarh.ellotv.activitytry-1.apk:/assets/fonts/ubuntu_r.ttf: 346K
      zip:/data/app/bigdig.yarh.ellotv.activitytry-1.apk:/assets/fonts/ubuntu_l.ttf: 406K
      zip:/data/app/bigdig.yarh.ellotv.activitytry-1.apk:/assets/fonts/ubuntu_r.ttf: 346K
      zip:/data/app/bigdig.yarh.ellotv.activitytry-1.apk:/assets/fonts/ubuntu_l.ttf: 406K
      zip:/data/app/bigdig.yarh.ellotv.activitytry-1.apk:/assets/fonts/ubuntu_r.ttf: 346K
      zip:/data/app/bigdig.yarh.ellotv.activitytry-1.apk:/assets/fonts/ubuntu_l.ttf: 406K
      zip:/data/app/bigdig.yarh.ellotv.activitytry-1.apk:/assets/fonts/ubuntu_r.ttf: 346K
      zip:/data/app/bigdig.yarh.ellotv.activitytry-1.apk:/assets/fonts/ubuntu_l.ttf: 406K
      zip:/data/app/bigdig.yarh.ellotv.activitytry-1.apk:/assets/fonts/ubuntu_l.ttf: 406K
      zip:/data/app/bigdig.yarh.ellotv.activitytry-1.apk:/assets/fonts/ubuntu_r.ttf: 346K
      zip:/data/app/bigdig.yarh.ellotv.activitytry-1.apk:/assets/fonts/ubuntu_l.ttf: 406K
      zip:/data/app/bigdig.yarh.ellotv.activitytry-1.apk:/assets/fonts/ubuntu_r.ttf: 346K
      zip:/data/app/bigdig.yarh.ellotv.activitytry-1.apk:/assets/fonts/ubuntu_l.ttf: 406K
      zip:/data/app/bigdig.yarh.ellotv.activitytry-1.apk:/assets/fonts/ubuntu_r.ttf: 346K
      zip:/data/app/bigdig.yarh.ellotv.activitytry-1.apk:/assets/fonts/ubuntu_l.ttf: 406K
      zip:/data/app/bigdig.yarh.ellotv.activitytry-1.apk:/assets/fonts/ubuntu_r.ttf: 346K
      zip:/data/app/bigdig.yarh.ellotv.activitytry-1.apk:/assets/fonts/ubuntu_l.ttf: 406K
      zip:/data/app/bigdig.yarh.ellotv.activitytry-1.apk:/assets/fonts/ubuntu_r.ttf: 346K
      zip:/data/app/bigdig.yarh.ellotv.activitytry-1.apk:/assets/fonts/ubuntu_l.ttf: 406K
      zip:/data/app/bigdig.yarh.ellotv.activitytry-1.apk:/assets/fonts/ubuntu_r.ttf: 346K
      zip:/data/app/bigdig.yarh.ellotv.activitytry-1.apk:/assets/fonts/ubuntu_l.ttf: 406K
  </code></pre>
  
  <p>Allocations:
  There about 500 object allocations withe mean size of 30kb.<br>
  Also there present 2 big allocations ~10 MB each, which are caused by asset managment</p>
  
  <pre><code>32  char[]  10224   9   android.content.res.AssetManager.getAssetAllocations(Native Method)
  21  char[]  10224   9   java.lang.String.toCharArray(String.java:1477)
  </code></pre>
  
  <p>Memory monitor shows that app consume 20 MB after start, than 24MB after first video started to play. Afterwards, consumption is slowly grows to ~50MB And does not request more memory.</p>
  
  <p>Is there a way to reliably estimate how much memory app should use?</p>