[TIMOB-20042] iOS: TiNetworkHTTPClientProxy Memory Leak
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2015-12-08T18:52:40.000+0000 |
Affected Version/s | Release 5.0.2 |
Fix Version/s | n/a |
Components | iOS |
Labels | 5.0, 5.0.0.GA, Ti.network, httpclient |
Reporter | Cameron |
Assignee | Eric Merriman |
Created | 2015-09-20T15:12:18.000+0000 |
Updated | 2017-03-23T21:35:29.000+0000 |
Description
When creating a Ti.Network.createHTTPClient, after the connection closes, a TiNetworkHTTPClientProxy does not get garbage collected. With repeated calls, they will start to build up to a very large #.
1. Open Instruments
2. Run this code
var myurl = "http://www.google.com";
var xhrshowsite = Ti.Network.createHTTPClient();
xhrshowsite.onload = function() {
xhrshowsite = null;
};
xhrshowsite.onerror = function() {
xhrshowsite = null;
};
// open the client
xhrshowsite.open("GET",myurl);
xhrshowsite.setTimeout([5000]);
xhrshowsite.send();
This did not affect pre-5.x SDK.
Marking ticket as invalid. The garbage collection in javascript is lazy, not instant. If you let the app sit for a bit, you'll see the allocations go down. This will not cause problems to the app since the garbage collector will run if the app feels memory pressure as well.
Closing ticket as invalid with reference to the previous comments.