{ "id": "170909", "key": "TIMOB-25693", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "19957", "description": "", "name": "Release 7.1.0", "archived": false, "released": true, "releaseDate": "2018-03-14" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2018-02-26T22:16:40.000+0000", "created": "2018-01-22T21:30:29.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "listitem", "listview" ], "versions": [], "issuelinks": [], "assignee": { "name": "ybanev", "key": "ybanev", "displayName": "Yordan Banev", "active": true, "timeZone": "Europe/Athens" }, "updated": "2018-05-23T18:28:56.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "Looking at Android Device Monitor, memory usage appears to balloon on Android when using .setSections() on a ListView, particularly when the ListDataItem array for the ListSections is large and when sections are set multiple times. Memory doesn’t seem to clear even when the ListView is removed and its parent controller proxy is cleared and the controller is destroyed. The attached project demonstrates the issue. Clicking \"Open List View\" populates the ListView with 5 ListSections, each with 1,000 ListDataItems. Clicking \"Repopulate List View\" creates a new set of 5 sections and sets those sections on the existing list view. The memory footprint increases significantly with each repopulation and never seems to reset. Clicking \"Close List View\" destroys the controller holding the ListView, but the memory doesn’t appear to reset in that scenario either. Eventually the application runs out of memory and crashes.\r\n\r\nAdditional notes: If I put a single ListSection in the XML for the ListView and use setItems on that single ListSection the memory does appear to reset, so it seems to be related to setSections, however in both scenarios if I close the view and destroy the controller the memory does not reset.", "attachment": [ { "id": "64725", "filename": "listviewleak.zip", "author": { "name": "ryan@mvretail.com", "key": "ryan@mvretail.com", "displayName": "Ryan Aston", "active": true, "timeZone": "America/Chicago" }, "created": "2018-01-22T21:30:26.000+0000", "size": 62610, "mimeType": "application/zip" } ], "flagged": false, "summary": "Android: Possible memory leak when setting ListSections on a ListView", "creator": { "name": "ryan@mvretail.com", "key": "ryan@mvretail.com", "displayName": "Ryan Aston", "active": true, "timeZone": "America/Chicago" }, "subtasks": [], "reporter": { "name": "ryan@mvretail.com", "key": "ryan@mvretail.com", "displayName": "Ryan Aston", "active": true, "timeZone": "America/Chicago" }, "environment": "MacOS 10.13.2\r\nTitanium SDK 6.1.2.GA/7.0.1.GA\r\nPixel simulator using Android 7.1.1", "closedSprints": [ { "id": 1000, "state": "closed", "name": "2018 Sprint 04 SDK", "startDate": "2018-02-12T04:23:01.913Z", "endDate": "2018-02-26T04:23:00.000Z", "completeDate": "2018-02-26T19:36:01.769Z", "originBoardId": 114 }, { "id": 126, "state": "closed", "name": "2018 Sprint 05 SDK", "startDate": "2018-02-25T19:38:08.926Z", "endDate": "2018-03-11T18:38:00.000Z", "completeDate": "2018-03-11T22:06:01.520Z", "originBoardId": 100 } ], "comment": { "comments": [ { "id": "433882", "author": { "name": "ybanev", "key": "ybanev", "displayName": "Yordan Banev", "active": true, "timeZone": "Europe/Athens" }, "body": "PR: https://github.com/appcelerator/titanium_mobile/pull/9784", "updateAuthor": { "name": "ybanev", "key": "ybanev", "displayName": "Yordan Banev", "active": true, "timeZone": "Europe/Athens" }, "created": "2018-01-31T13:16:59.000+0000", "updated": "2018-01-31T13:16:59.000+0000" }, { "id": "434661", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~ybanev], Can you please provide a backport.", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-02-20T19:05:33.000+0000", "updated": "2018-02-20T19:05:33.000+0000" }, { "id": "434666", "author": { "name": "ybanev", "key": "ybanev", "displayName": "Yordan Banev", "active": true, "timeZone": "Europe/Athens" }, "body": "[~lchoudhary] I am still working on changes after the review feedback.", "updateAuthor": { "name": "ybanev", "key": "ybanev", "displayName": "Yordan Banev", "active": true, "timeZone": "Europe/Athens" }, "created": "2018-02-20T19:25:56.000+0000", "updated": "2018-02-20T19:25:56.000+0000" }, { "id": "434759", "author": { "name": "ybanev", "key": "ybanev", "displayName": "Yordan Banev", "active": true, "timeZone": "Europe/Athens" }, "body": "7_1_X:https://github.com/appcelerator/titanium_mobile/pull/9868", "updateAuthor": { "name": "ybanev", "key": "ybanev", "displayName": "Yordan Banev", "active": true, "timeZone": "Europe/Athens" }, "created": "2018-02-22T10:37:29.000+0000", "updated": "2018-02-22T10:37:29.000+0000" }, { "id": "434938", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "FR Passed.\r\nPR's merged.", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-02-26T22:16:34.000+0000", "updated": "2018-02-26T22:16:34.000+0000" }, { "id": "435278", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified the fix in SDK 7.2.0.v20180305152636 & 7.1.0.v20180306061214.\r\n\r\nClosing.\r\n\r\nStudio Ver: 5.0.0.201712081732\r\nOS Ver: 10.13.2\r\nXcode Ver: Xcode 9.2\r\nAppc NPM: 4.2.12\r\nAppc CLI: 7.0.2\r\nDaemon Ver: 1.0.1\r\nTi CLI Ver: 5.0.14\r\nAlloy Ver: 1.11.0\r\nNode Ver: 8.9.1\r\nNPM Ver: 5.5.1\r\nJava Ver: 1.8.0_101\r\nDevices: ⇨ google Nexus 5 — Android 6.0.1\r\n⇨ google Nexus 6P — Android 8.0.0", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-03-06T23:38:30.000+0000", "updated": "2018-03-06T23:38:30.000+0000" }, { "id": "437857", "author": { "name": "cliff_stander", "key": "cliff_stander", "displayName": "Mike Stancliffe", "active": true, "timeZone": "America/Los_Angeles" }, "body": "This issue seems to still be present in 7.1.1", "updateAuthor": { "name": "cliff_stander", "key": "cliff_stander", "displayName": "Mike Stancliffe", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-05-22T20:24:46.000+0000", "updated": "2018-05-22T20:24:46.000+0000" }, { "id": "437891", "author": { "name": "ryan@mvretail.com", "key": "ryan@mvretail.com", "displayName": "Ryan Aston", "active": true, "timeZone": "America/Chicago" }, "body": "This issue is definitely not fixed in 7.1.1.GA or even in 7.2.0.v20180305152636 despite being marked as closed.\r\n\r\nAttempting to back port the original proposed fix into 7.1.0.GA introduced another issue. There are scenarios in our application where we may remove a ListSection or clear all of the ListSections from a ListView, however we want to maintain the ListSection(s) in memory so that they may be reinserted into the ListView. Doing so greatly increases performance in our application under certain scenarios. With the initial fix in place we noticed when setSections is called on the ListView with an empty array all of the ListSections are destroyed regardless of whether or not an accessible proxies are still present, thus causing the accessible proxies to now refer to null objects. A more accurate fix for this issue would only destroy a ListSection or ListSections upon removal from a ListView if there are no longer any accessible proxies associated with the ListSection(s) in question, allowing us to easily reuse ListSections. I have updated my original code sample to demonstrate this use case. I am unable to attach it to this JIRA, so I’ve put it on Google Drive: [https://drive.google.com/file/d/1wYTmjAbY3WHk-2gf1Fdz6rkk0E0SpHUo/view?usp=sharing|https://drive.google.com/file/d/1wYTmjAbY3WHk-2gf1Fdz6rkk0E0SpHUo/view?usp=sharing]. Click OPEN LIST VIEW 2, Click REMOVE ALL LIST SECTIONS, then click REINSERT ALL LIST SECTIONS to demonstrate the behavior. Currently this works without issue, however the first proposed fix for this issue would destroy the ListSections when REMOVE ALL LIST SECTIONS (setSections([])) was clicked.", "updateAuthor": { "name": "ryan@mvretail.com", "key": "ryan@mvretail.com", "displayName": "Ryan Aston", "active": true, "timeZone": "America/Chicago" }, "created": "2018-05-23T18:28:56.000+0000", "updated": "2018-05-23T18:28:56.000+0000" } ], "maxResults": 10, "total": 10, "startAt": 0 } } }