title: Why does a closed NetConnection that has no event listeners or references stick around in memory?
body: <p>It seems that if flash.net.NetConnection is instantiated and connected to an HTTP URL (such as an AMFPHP gateway), that instance is never picked up by garbage collection even after it has been closed and the only reference is set to null.</p>
  
  <p>On the other hand, if the instance is connected to null (as would be done when used to play video/mp3 files), the instance <em>is</em> cleared from memory.</p>
  
  <p>To clarify, the following connection will stick around in memory:</p>
  
  <pre><code>var stickyConn:NetConnection = new NetConnection();
  stickyConn.connect("http://myserver/amfphp/gateway.php");
  stickyConn.close();
  stickyConn = null;
  </code></pre>
  
  <p>Whereas, the following connection will be cleared from memory immediately:</p>
  
  <pre><code>var tempConn:NetConnection = new NetConnection();
  tempConn.connect(null);
  tempConn.close();
  tempConn = null;
  </code></pre>
  
  <p>Some things I have already tried to solve this issue:</p>
  
  <ul>
  <li>set the client to an empty object (since the default value of the client is the NetConnection itself)</li>
  <li>before closing the connection, call <code>connect(null)</code></li>
  <li><em>after</em> closing the connection, call <code>connect(null)</code> and close it again</li>
  </ul>
  
  <p>Has anyone run into this issue before? Is there a solution to this?</p>