title: How to track down memory leak - Find living references
body: <p>I have a fairly complex app -</p>
  
  <p>The UI Activity launches a Service and sets up 2 way AIDL callbacks so the two can communicate.</p>
  
  <p>The service runs forever (unless hits 'off' button in UI Activity).  </p>
  
  <p>The problem is when the user exits the Activity, the Activity memory is not released.
  -The amount of memory used by my app is the same even if the UI Activity has been closed.
  -The heap still shows mapTiles and other UI crap on it even if the UI Activity has been closed.</p>
  
  <p>So my guess is somehow the Service is holding references to the Activity.  I know the many articles warning about leaking the Activity Context.  The Service only references the Activity through a Weak Reference stored at Application scope. (a class that extends Application)</p>
  
  <p>Is there any way to find what specifically is referencing the Activity?  The dominator tree shows mapTiles and ListView layouts eating all my memory... but I can't find the reference to the Activity which is keeping that stuff alive.</p>
  
  <p>Also, <strong>is there a way to dump an HPROF heap dump thing if OutOfMemoryException occurs?</strong></p>