[TIMOB-27207] TableView / TableViewRow memory leak
GitHub Issue | n/a |
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2019-10-15T11:11:11.000+0000 |
Affected Version/s | Release 8.0.0, Release 8.0.1 |
Fix Version/s | Release 8.2.1 |
Components | iOS |
Labels | n/a |
Reporter | VDLP |
Assignee | Jan Vennemann |
Created | 2019-06-28T14:06:11.000+0000 |
Updated | 2020-06-02T01:29:26.000+0000 |
Description
Old table row references are not cleared when calling *tableView.setData(rows)*.
In a production app running SDK 7.4.1.GA this is causing serious memory issues. Because the row structure is quite complex, it's important that old rows are completely cleaned from memory before new ones are set.
We've been able to reproduce this issue in a example application for multiple SDK's (8.0.0.GA, 7.4.1.GA, 8.0.1.GA). As demonstrated in the attached video you can see that the objects are not cleared from memory. The source code for the app running in the video has also been attached to this issue.
We've tried calling $.off();$.destroy();
on the controllers/imagerow
controller, this does not destroy the proxies.
Attachments
[~menzo], Thanks for sharing with us. Are you experiencing this for both iOS and android platform?
Currently testing this on iOS. Not sure how to accurately profile Android. For our production app, the memory issues also occur on Android.
Any updates on this? :)
[~menzo], Thanks for your feedback. Can you please test this on 8.0.2.GA and let us know the results?
We've already tested this on 8.0.2.GA. Same issues, the Proxy's are not removed.
[^memleak8.0.2.GA.mp4]
[~menzo], Are you experiencing the same behaviour also in device also? Can you please check that?
Yes.
PR (master): https://github.com/appcelerator/titanium_mobile/pull/11028 PR (8_1_X): https://github.com/appcelerator/titanium_mobile/pull/11029 [~menzo], you may want to try this line before you update
table.data
as a workaround:[~menzo], Hope you are doing fine today. Would you please reply us regarding previous reviews? We are looking forward to your response.
Fix suggested by Jan doesn't work on *7.4.1.GA* & *8.0.2.GA*
Our app is running on 7.4 so upgrading to 8.1.X isn't really a option at this moment. Some more info on how the above code snippet is supposed fix our problem would be great.
[~menzo], see the ticket for a in-depth explanation. Long story short, accessing the sections and rows in JavaScript once will make sure they get properly garbage collected like they should. Here is a longer example which should make it more clear how to apply this workaround:
Note that it may take a while for the JS garbage collection to kick in so you won't notice an immediate change in Instruments.
PR (8_2_X): https://github.com/appcelerator/titanium_mobile/pull/11274
Thought I'd give this a go, but for me FR: Failed. Please see attached PDF of findings. [^Findings for TIMOB-27207.pdf]
PR's merged.
Verified on builds 8.2.1.v20191014114554 and 8.3.0.v20191014114038. Ticked closed.