It seems that if flash.net.NetConnection is created and connected to an HTTP URL (such as an AMFPHP gateway), this instance is never picked up by garbage collection even after it has been closed and the only link set to zero.
On the other hand, if the instance is tied to zero (as it would be when playing video / mp 3 files), the instance is cleared from memory.
To clarify, the following connection will be stored in memory:
var stickyConn:NetConnection = new NetConnection(); stickyConn.connect("http://myserver/amfphp/gateway.php"); stickyConn.close(); stickyConn = null;
While the following connection will be immediately removed from memory:
var tempConn:NetConnection = new NetConnection(); tempConn.connect(null); tempConn.close(); tempConn = null;
Some things that I have already tried to solve this problem:
- set the client to an empty object (since the default value for the client is NetConnection itself)
- call
connect(null) before closing the connection - after closing the connection, call
connect(null) and close it again
Has anyone encountered this problem before? Is there a solution for this?
source share