title: Possible memory leak Android
body: <p>I ran this command <code>adb shell dumpsys meminfo &lt;package_name&gt;</code> and got </p>
  
  <pre><code> Objects
                 Views:       74         ViewRootImpl:        1
           AppContexts:        3           Activities:        1
                Assets:        4        AssetManagers:        4
         Local Binders:       11        Proxy Binders:       20
      Death Recipients:        0
       OpenSSL Sockets:        2
  
   SQL
           MEMORY_USED:        0   
    PAGECACHE_OVERFLOW:        0          MALLOC_SIZE:        0
  </code></pre>
  
  <p>after pressing back button and launching app again and just repeating this process several times gives:</p>
  
  <pre><code> Objects
                 Views:     1408         ViewRootImpl:        8
           AppContexts:       14           Activities:       12
                Assets:        5        AssetManagers:        5
         Local Binders:       13        Proxy Binders:       32
      Death Recipients:        0
       OpenSSL Sockets:        1
  
   SQL
           MEMORY_USED:        0
    PAGECACHE_OVERFLOW:        0          MALLOC_SIZE:        0
  </code></pre>
  
  <p>Note the <strong>Activities</strong> and <strong>AppContexts</strong> count they just keep increasing by just launching the app again and again. Does this mean I have a memory leak?</p>
  
  <p>I read this document <a href="https://developer.android.com/tools/debugging/debugging-memory.html#ViewingAllocations" rel="nofollow">https://developer.android.com/tools/debugging/debugging-memory.html#ViewingAllocations</a> which says: </p>
  
  <blockquote>
    <p>AppContexts and Activities The number of app Context and Activity
    objects that currently live in your process. This can be useful to
    quickly identify leaked Activity objects that can’t be garbage
    collected due to static references on them, which is common. These
    objects often have a lot of other allocations associated with them and
    so are a good way to track large memory leaks.</p>
  </blockquote>