GitHub Issue | n/a |
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-08-14T16:01:18.000+0000 |
Affected Version/s | Release 3.0.0 |
Fix Version/s | Sprint 2012-16 API, Release 3.0.0 |
Components | Android |
Labels | core, module_xml, qe-review, qe-testadded |
Reporter | Josh Roesslein |
Assignee | Josh Roesslein |
Created | 2012-07-23T13:19:17.000+0000 |
Updated | 2013-09-05T17:37:39.000+0000 |
It appears the HTTPClient never releases the function callbacks for on*** events (ex: onload).
This can lead to memory referenced by variables in this function's scope getting leaked.
Create an application with the attached app.js script.
1. Run the application and monitor with DDMS.
2. Click "Send XHR Request".
3. Repeat step #2 and see if the heap size continues to grow out of control.
Expected: Memory referenced by the function callback should eventually get collected.
Actual: Memory is never collected causing the heap to grow indefinitely.
Another cause of the memory leak seen in TIMOB-10040.
Created [PR #2687](https://github.com/appcelerator/titanium_mobile/pull/2687) to resolve issue.
Created [PR #2746](https://github.com/appcelerator/titanium_mobile/pull/2746) to back port fix into 2_1_X.
The referenced memory gets collected. Verified on: Titanium Studio: 2.1.3.201209071738 Titanium SDK: 2.2.0.v20120907162025 Android Emulator v2.3 Runtime: v8
In TiHTTPClient.java, method setReadyState, you're calling: dispatchCallback("onreadystatechanged", null); but is "onreadystatechange" <-- notice there's no -d
Jordi, you saved the day! Thanks for catching this regression and typo. I have opened TIMOB-11751 to resolve this bug.