Copy link to clipboard
Copied
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.
On the other hand, if the instance is connected to null (as would be done when used to play video/mp3 files), the instance is cleared from memory.
To clarify, the following connection will stick around in memory:
var stickyConn:NetConnection = new NetConnection();
stickyConn.connect("http://myserver/amfphp/gateway.php");
stickyConn.close(); stickyConn = null;
Whereas, the following connection will be cleared from memory immediately:
var tempConn:NetConnection = new NetConnection();
tempConn.connect(null);
tempConn.close();
tempConn = null;
Some things I have already tried to solve this issue:
connect(null)
connect(null)
and close it againHas anyone run into this issue before? Is there a solution to this?
Copy link to clipboard
Copied
1. are you defining a netstream?
2. how do you know stickyConn is not cleared from memory?
Copy link to clipboard
Copied
I am not defining a NetStream, as it is not necessary for AMFPHP communication.
I know for a fact that stickyConn is not cleared from memory because I am using a profiler that shows me how many objects of each type are still in memory (and I am able to view where/when each instance was instantiated)
Find more inspiration, events, and resources on the new Adobe Community
Explore Now