title: Why should I dismiss AlertDialog manually in Android?
body: <p>Why should I call dismiss() method for AlertDialog before Activity is destroyed? Something leaks, but what exactly? Why then PopupWindow can handle Activity destroying?</p>
  
  <p>I've found in Android sources that each alert dialog creates window:</p>
  
  <pre><code>Window w = PolicyManager.makeNewWindow(mContext);
  </code></pre>
  
  <p>What does that mean? Why it cannot just use PhoneWindow obtained from activity?</p>
  
  <p>ADDED</p>
  
  <p>Say, AlertDialog references Context, Context references nothing, then GC should garbage collect both objects (as they are not referenced from 'outside'). What else has a reference to AlertDialog? In other words where is exactly memory leak?</p>