[TIMOB-26239] Android: Window leak in Ti.UI.currentWindow
GitHub Issue | n/a |
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2019-04-23T18:28:39.000+0000 |
Affected Version/s | Release 7.3.0, Release 7.2.0 |
Fix Version/s | Release 8.0.1 |
Components | Android |
Labels | android, cache, engSchedule, leak, module, require |
Reporter | Sergey Volkov |
Assignee | Gary Mathews |
Created | 2018-07-26T09:02:38.000+0000 |
Updated | 2019-04-23T18:28:39.000+0000 |
Description
Steps to reproduce:
1. Create application, put attached files in Resources
2. Run ti build
with --debug-host localhost:8990
3. Open chrome-devtools://
link in Chrome
4. Resume script execution, wait for app load
5. In memory tab, press "Take snapshot"
6. In app press "OPEN 2ND WINDOW"
7. In memory tab, press "Take snapshot"
8. In app press "OPEN 3RD WINDOW"
9. In memory tab, press "Take snapshot"
10. In app press back button
11. In memory tab, press "Take snapshot"
12. In app press back button
13. In memory tab, press "Take snapshot"
Now you got five snapshots.
1. Select "Snapshot 2"
2. Change "Summary" to "Comparison", put "Window" in "Class filter"
3. Expand "Window", observe one new "Window" instance, remember @id
4. Select "Snapshot 5", put "Window" in "Class filter"
5. Expand "Window", observe three instance of "Window"
6. Select "Window" instance with @id from (3)
7. Observe "Retainers" below
Attachments
In summary: first
require
(once for each module) cause enclosuring current "Window" in "Ti.UI.currentWindow" which persist in context of this module. Since modules are cached this means that this "Window" (and all its children) will not be collected by gc. Same goes for "Ti.UI.currentActivity".The
Ti.UI.currentWindow
property has been removed since 6.0.0, but I assume you mean the general window scope? cc [~jquick]>The Ti.UI.currentWindow property has been removed since 6.0.0 It is still there for android, look at the patch in attachments.
I see! But shouldn't it be removed there as well? I see that your PR might do exactly that (not an Android pro here) :-)
This is something we're already actively looking into. Pleas see the below. https://github.com/appcelerator/titanium_mobile/pull/10195
It's good to know, but actually that PR does not cover this case. Leak is in
titanium.js
and not in java side.bq. Status: RESOLVED The PR that Joshua mentioned above and both PRs labeled as "TIMOB-26239" are not related to this issue.
Hello everyone. Just trying to say that nothing has been done yet to address this issue. P.S. "User mention" feature seems not working (or disabled for me), hope Joshua Quick and Gary Mathews will receive notification anyway.
We'll re-look into this later. For now, we're rolling with what we've got for 7.3.0 since it has full Android 8 support and targeting it is currently required by Google Play.
https://github.com/appcelerator/titanium_mobile/pull/10749
8_0_X: https://github.com/appcelerator/titanium_mobile/pull/10792
FR Passed. waiting for resolving jenkin test failure to merge.
Merged to 8_0_X and master
Verified the fix on SDK 8.1.0.v20190423074844 and 8.0.1.v20190418104938. works as expected.Closing