{ "id": "162244", "key": "TIMOB-23715", "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": "17608", "name": "Release 6.1.0", "archived": false, "released": true, "releaseDate": "2017-05-26" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2016-12-07T08:58:15.000+0000", "created": "2016-07-28T19:09:46.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "android", "leak", "listview", "memory" ], "versions": [], "issuelinks": [ { "id": "54012", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "165016", "key": "TIMOB-24225", "fields": { "summary": "Android: close event is not fired when a window is closed", "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" } }, "priority": { "name": "Critical", "id": "1" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-01-23T16:37:39.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": "Problem: After closing a window with a listView inside its activity never gets finished causing a memory leak. This occurs even if the listView has no elements or listeners in its template. Eventually all this leaked memory causes the application to crash.\r\n\r\nSteps to reproduce:\r\n1. Start the application (attached listViewMemoryLeak.js script)\r\n2. Create a heap dump in DDMS\r\n3. Tap the 'ListView' or 'ListView empty' buttons\r\n4. Tap the back button\r\n5. Cause GC\r\n6. Create a second heap dump in DDMS\r\n7. Do a comparison of the two heap dumps with Eclipse Memory Analyzer. The second heap dump has multiple new and living objects compared to the first heap dump. If you tap the 'View' or 'ScrollView' buttons instead and repeat the same process you'll notice that this does not occur.", "attachment": [ { "id": "59960", "filename": "app.js", "author": { "name": "mateuskamoei", "key": "mateuskamoei", "displayName": "Mateus Kamoei", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-08-01T12:15:26.000+0000", "size": 2714, "mimeType": "application/x-javascript" }, { "id": "59949", "filename": "listViewMemoryLeak.js", "author": { "name": "mateuskamoei", "key": "mateuskamoei", "displayName": "Mateus Kamoei", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-07-28T18:46:07.000+0000", "size": 2418, "mimeType": "text/javascript" }, { "id": "59961", "filename": "memory_leak.pdf", "author": { "name": "mateuskamoei", "key": "mateuskamoei", "displayName": "Mateus Kamoei", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-08-01T12:15:28.000+0000", "size": 337537, "mimeType": "application/pdf" } ], "flagged": false, "summary": "Android: Memory leak when window has listView inside", "creator": { "name": "mateuskamoei", "key": "mateuskamoei", "displayName": "Mateus Kamoei", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "mateuskamoei", "key": "mateuskamoei", "displayName": "Mateus Kamoei", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Titanium SDK: 5.2.2\r\nMoto G 3rd Gen Android 6.0", "closedSprints": [ { "id": 770, "state": "closed", "name": "2016 Sprint 25 SDK", "startDate": "2016-12-03T01:53:07.491Z", "endDate": "2016-12-17T01:53:00.000Z", "completeDate": "2016-12-21T03:19:43.884Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "391895", "author": { "name": "rramirez", "key": "rramirez", "displayName": " Ricardo Ramirez", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hello ! \r\n\r\nI took a look at the code and this is not problem from our sdk, this is happening because you are not closing the windows, each time you open a window, it creates a new instance and if you open the window again it is creating a new one. To avid this you can close all windows before open a new one, to close a window, you only need to do it the same way you open it, just add in the code {code}yourwindowvar.close();{code} so you can close all the windows before open new ones in your events. ", "updateAuthor": { "name": "rramirez", "key": "rramirez", "displayName": " Ricardo Ramirez", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-07-28T21:16:42.000+0000", "updated": "2016-07-28T21:16:42.000+0000" }, { "id": "392007", "author": { "name": "mateuskamoei", "key": "mateuskamoei", "displayName": "Mateus Kamoei", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hi Ricardo,\r\n\r\nThanks for the quick reply! So what you are suggesting is to add an androidback event for every window opened that calls window.close()?\r\nAlso I still don't understand why there is a difference in the number of activities seen on the heap dump.\r\n\r\nIn the following heap dump screen shot, in the attached test app I just tapped the \"View\" button and then tapped the back button. You can see there is only *1 TiActivity object*.\r\n[http://imgur.com/jJKxq3J]\r\n\r\nIn this next heap dump screen shot, in the attached test app I tapped the \"ListView\" button and then tapped the back button. The result is there are *2 TiActivity objects* remaining.\r\n[http://imgur.com/3oZOV8v]\r\n\r\nI closed the app before both tests executions. ", "updateAuthor": { "name": "mateuskamoei", "key": "mateuskamoei", "displayName": "Mateus Kamoei", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-07-29T16:26:09.000+0000", "updated": "2016-07-29T16:27:24.000+0000" }, { "id": "392111", "author": { "name": "mateuskamoei", "key": "mateuskamoei", "displayName": "Mateus Kamoei", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Attached two new files:\r\n- memory_leak.pdf: steps to reproduce the issue;\r\n- app.js: new sample code.", "updateAuthor": { "name": "mateuskamoei", "key": "mateuskamoei", "displayName": "Mateus Kamoei", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-08-01T12:16:43.000+0000", "updated": "2016-08-01T12:16:43.000+0000" }, { "id": "392238", "author": { "name": "rramirez", "key": "rramirez", "displayName": " Ricardo Ramirez", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Hello ! The ticket is moved, do not remember that the main issue is that exists a memory leak after close a window with a listview inside. ", "updateAuthor": { "name": "rramirez", "key": "rramirez", "displayName": " Ricardo Ramirez", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-08-02T21:25:49.000+0000", "updated": "2016-08-02T21:25:49.000+0000" }, { "id": "397350", "author": { "name": "fmerzadyan-OLD", "key": "fmerzadyan", "displayName": "Farzad Merzadyan", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Using the monitor in IntelliJ, it states that clicking any of the buttons will cause leaked activities. The leak isn't attributed to only those activities containing the listview. For some reason, the activities aren't being destroyed.", "updateAuthor": { "name": "fmerzadyan-OLD", "key": "fmerzadyan", "displayName": "Farzad Merzadyan", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2016-09-27T06:20:08.000+0000", "updated": "2016-09-27T06:20:08.000+0000" }, { "id": "401364", "author": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "body": "master: https://github.com/appcelerator/titanium_mobile/pull/8616", "updateAuthor": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-11-17T17:18:28.000+0000", "updated": "2016-11-17T17:18:28.000+0000" }, { "id": "404602", "author": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified fixed using the test code provided by [~gmathews] in https://github.com/appcelerator/titanium_mobile/pull/8616 was able to see number of objects and heap size decrease. To test Garys test case I took the following steps:\r\n\r\n1. Start the application\r\n2. Create a heap dump in DDMS\r\n3. Tap the {{TI.UI.ListView}} or {{TI.UI.View empty}} buttons\r\n4. Tap the back button\r\n5. Cause GC\r\n6. Create a second heap dump in DDMS\r\n7. Repeat process on the latest SDK build and see if {{Ti.UI.ListView}} stops leaking memory\r\n\r\n\r\n*Environment*\r\n{code:java}\r\nAppcelerator Command-Line Interface, version 6.1.0\r\nNexus 6p (Android 7.1)\r\nOperating System Name: Mac OS X El Capitan\r\nOperating System Version: 10.11.6\r\nNode.js Version: 4.6.0\r\nnpm: 4.2.8\r\nTitanium SDK Version: 6.1.0.v20170112013001\r\nXcode: 8.2\r\nAppcelerator Studio: 4.8.1.201612050850\r\n{code}", "updateAuthor": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-01-13T18:47:48.000+0000", "updated": "2017-01-13T18:47:48.000+0000" } ], "maxResults": 7, "total": 7, "startAt": 0 } } }