{ "id": "150147", "key": "TIMOB-19891", "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": "17684", "name": "Release 5.2.1", "archived": false, "released": true, "releaseDate": "2016-03-25" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2016-03-07T19:04:13.000+0000", "created": "2015-08-04T20:53:39.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "android" ], "versions": [], "issuelinks": [], "assignee": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "updated": "2016-03-08T20:19:03.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": "I open some windows and then close all one by one except first one. In 4.1.0.GA more then one WindowProxy object remain in memory but must only one. In 3.5.1.GA remain two objects.\r\nIn the iphone only first one.\r\n\r\n{code:javascript}\r\n(function openWindow(n) {\r\n\r\n var win = Ti.UI.createWindow({\r\n backgroundColor : \"#aaaaaa\",\r\n layout : \"vertical\" \r\n }); \r\n\r\n win.title = \"Window # \" + n;\r\n\r\n var label = Ti.UI.createLabel({\r\n text : \"Window # \" + n,\r\n color : \"#ffffff\",\r\n top : 20\r\n });\r\n win.add(label);\r\n\r\n var openButton = Ti.UI.createButton({\r\n title : \"Open\",\r\n color : \"#ffffff\",\r\n top : 20\r\n });\r\n openButton.addEventListener('click', function onOpenByButton(evt) {\r\n openWindow(n + 1);\r\n });\r\n\r\n win.add(openButton);\r\n\r\n var closeButton = Ti.UI.createButton({\r\n title : \"Close\",\r\n color : \"#ffffff\",\r\n top : 20\r\n });\r\n closeButton.addEventListener('click', function onCloseByButton(evt) {\r\n win.close();\r\n win = null;\r\n });\r\n\r\n win.add(closeButton);\r\n\r\n win.open();\r\n \r\n})(1);\r\n{code}\r\n\r\nMay be related to this changes https://github.com/appcelerator/titanium_mobile/commit/2b12ad61775920f8045e168ae678ce123dfa14b4#diff-034a9360d01584987d9c951c0a215f65\r\n\r\n!memoryleak.png|thumbnail!", "attachment": [ { "id": "56389", "filename": "3.5.1.GATest.png", "author": { "name": "morahman", "key": "morahman", "displayName": "Motiur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "created": "2015-08-11T09:21:20.000+0000", "size": 147972, "mimeType": "image/png" }, { "id": "56390", "filename": "4.1.0GATest.png", "author": { "name": "morahman", "key": "morahman", "displayName": "Motiur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "created": "2015-08-11T09:21:23.000+0000", "size": 163785, "mimeType": "image/png" }, { "id": "58421", "filename": "5.2.1.v20160303112058.png", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-03-04T00:23:05.000+0000", "size": 148543, "mimeType": "image/png" }, { "id": "56332", "filename": "memoryleak.png", "author": { "name": "falko", "key": "falko", "displayName": "Andrey Tkachenko", "active": true, "timeZone": "Europe/Moscow" }, "created": "2015-08-04T20:53:09.000+0000", "size": 81555, "mimeType": "image/png" }, { "id": "56409", "filename": "With SDK 4.2.0.v20150807112024.png", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-08-12T22:34:04.000+0000", "size": 197172, "mimeType": "image/png" } ], "flagged": false, "summary": "Android: Memory Leak on Window", "creator": { "name": "falko", "key": "falko", "displayName": "Andrey Tkachenko", "active": true, "timeZone": "Europe/Moscow" }, "subtasks": [], "reporter": { "name": "falko", "key": "falko", "displayName": "Andrey Tkachenko", "active": true, "timeZone": "Europe/Moscow" }, "environment": "{color:red}Ti SDK 4.0.0.GA/4.1.0.GA/5.0.2.GA{color}", "closedSprints": [ { "id": 574, "state": "closed", "name": "2016 Sprint 4 SDK", "startDate": "2016-02-13T01:33:48.415Z", "endDate": "2016-02-27T01:33:00.000Z", "completeDate": "2016-02-29T03:44:48.886Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "359735", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "The memory leak is seen on window with the above code in the description.\r\n\r\nAttached screenshot for reference.\r\n\r\nEnvironment:\r\nAppc Studio : 4.2.0.201508062204\r\nTi SDK : 4.2.0.v20150812103137\r\nTi CLI : 4.1.4\r\nAlloy : 1.6.2\r\nMAC Yosemite : 10.10.4\r\nAppc NPM : 4.1.0\r\nAppc CLI : 4.2.0-44\r\nNode: v0.10.37\r\nAndroid Emulator : android 4.4.2\r\nNode : v0.10.37\r\n", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-08-12T22:32:41.000+0000", "updated": "2015-08-12T22:32:41.000+0000" }, { "id": "360581", "author": { "name": "rtlechuga", "key": "rtlechuga", "displayName": "Radamantis Torres-Lechuga", "active": false, "timeZone": "Asia/Dubai" }, "body": "From my perspective, this leak it's because the construction of the test case, we have eventlisteners inside the window constructor, and the functions on the eventlistener are not outside the window constructor, to fully check this memory leak, we need a test case following best practices", "updateAuthor": { "name": "rtlechuga", "key": "rtlechuga", "displayName": "Radamantis Torres-Lechuga", "active": false, "timeZone": "Asia/Dubai" }, "created": "2015-08-20T23:14:33.000+0000", "updated": "2015-10-01T05:29:19.000+0000" }, { "id": "362292", "author": { "name": "falko", "key": "falko", "displayName": "Andrey Tkachenko", "active": true, "timeZone": "Europe/Moscow" }, "body": "Is anybody here?", "updateAuthor": { "name": "falko", "key": "falko", "displayName": "Andrey Tkachenko", "active": true, "timeZone": "Europe/Moscow" }, "created": "2015-09-04T12:23:22.000+0000", "updated": "2015-09-04T12:23:22.000+0000" }, { "id": "363760", "author": { "name": "falko", "key": "falko", "displayName": "Andrey Tkachenko", "active": true, "timeZone": "Europe/Moscow" }, "body": "Another use case for you if my first example seems bad for you:\r\nOpen and then close second window (simple empty window) from index controller in Alloy.\r\n\r\nWhen use 3.5.1.GA no one WindowProxy is present in memory after window closed.\r\nWhen use 4.x.x WindowProxy and it native objects remain in memory.\r\n\r\nGuys anybody can say something?\r\n", "updateAuthor": { "name": "falko", "key": "falko", "displayName": "Andrey Tkachenko", "active": true, "timeZone": "Europe/Moscow" }, "created": "2015-09-14T07:23:31.000+0000", "updated": "2015-09-14T07:23:31.000+0000" }, { "id": "365529", "author": { "name": "falko", "key": "falko", "displayName": "Andrey Tkachenko", "active": true, "timeZone": "Europe/Moscow" }, "body": "Ok look at another simple example and run it in 3.5.1.GA then 4.x.x etc.\r\n\r\n1. create dump on root window\r\n2. open first test window\r\n3. open second test window\r\n4. close second\r\n5. close first\r\n6. GC\r\n7. create second dump and diff with first dump \r\n\r\n{code:javascript|title=app.js}\r\n \r\nvar win = Ti.UI.createWindow({\r\n\tbackgroundColor : \"#aaaaaa\",\r\n\ttitle : \"root window\",\r\n\tlayout: \"vertical\"\r\n});\r\n\r\nvar openButton = Ti.UI.createButton({\r\n\ttitle : \"Open 1\",\r\n\tcolor : \"#ffffff\",\r\n\ttop : 20\r\n});\r\nopenButton.addEventListener('click', function(evt) {\r\n\tvar win = Ti.UI.createWindow({\r\n\t\tbackgroundColor : \"#ff0000\",\r\n\t\ttitle : \"test win 1\"\r\n\t});\r\n\tvar openButton = Ti.UI.createButton({\r\n\t\ttitle : \"Open 2\",\r\n\t\tcolor : \"#ffffff\",\r\n\t\ttop : 20\r\n\t});\r\n\topenButton.addEventListener('click', function(evt) {\r\n\t\tTi.UI.createWindow({\r\n\t\t\tbackgroundColor : \"#00ff00\",\r\n\t\t\ttitle : \"test win 2\"\r\n\t\t}).open();\r\n\t});\r\n\twin.add(openButton);\r\n\twin.open();\r\n\twin = null;\r\n\topenButton = null;\r\n});\r\n\r\nwin.add(openButton);\r\n\r\nopenButton = null;\r\n\r\nwin.open(); \r\n\r\n{code}\r\n", "updateAuthor": { "name": "falko", "key": "falko", "displayName": "Andrey Tkachenko", "active": true, "timeZone": "Europe/Moscow" }, "created": "2015-10-01T07:22:09.000+0000", "updated": "2015-10-01T07:23:04.000+0000" }, { "id": "369703", "author": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "body": "So you're saying you always need to remove all event listeners? I haven't seen that to be required. We might want to provide some more guiding in the docs on this and back that up with tests.", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2015-11-11T08:19:45.000+0000", "updated": "2015-11-11T08:19:45.000+0000" }, { "id": "369729", "author": { "name": "falko", "key": "falko", "displayName": "Andrey Tkachenko", "active": true, "timeZone": "Europe/Moscow" }, "body": "I saying that it not caused leaks before SDK 4.0.0. And issue not in listeners, please read carefuly my last comment.", "updateAuthor": { "name": "falko", "key": "falko", "displayName": "Andrey Tkachenko", "active": true, "timeZone": "Europe/Moscow" }, "created": "2015-11-11T10:02:55.000+0000", "updated": "2015-11-11T11:53:46.000+0000" }, { "id": "370033", "author": { "name": "jnaher", "key": "jnaher", "displayName": "Jebun Naher", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Hello\r\n\r\nWe tested this issue in our environment and observed memory leak happens.\r\n\r\nSteps to test:\r\n- We run the app for the first time and created dump 1\r\n- In the next step we run the app, opened window2 and window 3\r\n- Used android back button to close window 2 \r\n- And created dump 2\r\n\r\n- [Dump 1|http://postimg.org/image/hwuspceo9/]\r\n- [Dump 2|http://postimg.org/image/wt3rhkhb5/]\r\n\r\n*Testing Environment:*\r\nAppcelerator Command-Line Interface, version 5.0.4\r\nAppcelerator Studio, build: 4.3.3.201510212245\r\nTi SDK: 5.0.2 GA\r\nJava Development Kit : 1.7.0_65\r\nNode.js Version : 0.12.7\r\nMac Osx: 10.9.5\r\nAndroid Emulator: Samsung Galaxy S4(4.4.4)\r\n\r\nTest Case: \r\n{code}\r\nvar main_win = Ti.UI.createWindow({\r\n\tbackgroundColor : \"#aaaaaa\",\r\n\ttitle : \"root window\",\r\n\tlayout : \"vertical\"\r\n});\r\nvar main_Button = Ti.UI.createButton({\r\n\ttitle : \"Open 1\",\r\n\tcolor : \"#ffffff\",\r\n\ttop : 20\r\n});\r\nmain_Button.addEventListener('click', test);\r\nmain_win.add(main_Button);\r\nmain_win.open();\r\nvar win2 = Ti.UI.createWindow({\r\n\tbackgroundColor : \"#ff0000\",\r\n\ttitle : \"test win 2\"\r\n});\r\nvar button2 = Ti.UI.createButton({\r\n\ttitle : \"Open 2\",\r\n\tcolor : \"#ffffff\",\r\n\ttop : 20\r\n});\r\nbutton2.addEventListener('click', f2);\r\nwin2.add(button2);\r\nfunction test() {\r\n\twin2.open();\r\n\twin2.addEventListener('androidback', function() {\r\n\t\tmain_Button.removeEventListener('click', test);\r\n\t\twin2.close();\r\n\t\twin2 = null;\r\n\t});\r\n};\r\n\r\nfunction f2() {\r\n\tvar win3 = Ti.UI.createWindow({\r\n\t\tbackgroundColor : \"#00ff00\",\r\n\t\ttitle : \"test win 3\"\r\n\t});\r\n\twin3.open();\r\n\r\n\tsetTimeout(function() {\r\n\t\tbutton2.removeEventListener('click', f2);\r\n\t\twin3.close();\r\n\t\twin3 = null;\r\n\t}, 1000);\r\n\t\r\n};\r\n{code}\r\n\r\nThanks.", "updateAuthor": { "name": "fokkezb", "key": "fokke", "displayName": "Fokke Zandbergen", "active": true, "timeZone": "Europe/Amsterdam" }, "created": "2015-11-12T06:56:46.000+0000", "updated": "2016-02-05T18:20:23.000+0000" }, { "id": "376115", "author": { "name": "falko", "key": "falko", "displayName": "Andrey Tkachenko", "active": true, "timeZone": "Europe/Moscow" }, "body": "Whether there is any progress?", "updateAuthor": { "name": "falko", "key": "falko", "displayName": "Andrey Tkachenko", "active": true, "timeZone": "Europe/Moscow" }, "created": "2016-02-05T16:05:43.000+0000", "updated": "2016-02-05T16:06:37.000+0000" }, { "id": "376130", "author": { "name": "falko", "key": "falko", "displayName": "Andrey Tkachenko", "active": true, "timeZone": "Europe/Moscow" }, "body": "Please use instructions from my comment at: 01/Oct/15 10:22 AM\r\nAnd take dumps on single app session.\r\n\r\nWe will be so for a long time to fix this bug :( Year or two?", "updateAuthor": { "name": "falko", "key": "falko", "displayName": "Andrey Tkachenko", "active": true, "timeZone": "Europe/Moscow" }, "created": "2016-02-05T18:49:02.000+0000", "updated": "2016-02-05T18:51:38.000+0000" }, { "id": "377108", "author": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "body": "Any update on this issue?", "updateAuthor": { "name": "topener", "key": "topener", "displayName": "Rene Pot", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-02-17T14:43:27.000+0000", "updated": "2016-02-17T14:43:27.000+0000" }, { "id": "377226", "author": { "name": "falko", "key": "falko", "displayName": "Andrey Tkachenko", "active": true, "timeZone": "Europe/Moscow" }, "body": "I investigated changes and found that you need delete *static* from here https://github.com/appcelerator/titanium_mobile/blob/5_2_X/android/titanium/src/java/org/appcelerator/titanium/TiBaseActivity.java#L82 \r\n\r\nThis changes will solve this bug, tested with my last test example. Will be awesome to apply fix to the Ti.SDK 5.2.0", "updateAuthor": { "name": "falko", "key": "falko", "displayName": "Andrey Tkachenko", "active": true, "timeZone": "Europe/Moscow" }, "created": "2016-02-18T13:54:24.000+0000", "updated": "2016-02-18T13:54:24.000+0000" }, { "id": "377227", "author": { "name": "manuellehner", "key": "manuellehner", "displayName": "Manuel Lehner", "active": true, "timeZone": "Europe/Berlin" }, "body": "[~falko] Can you send a pull request for this?", "updateAuthor": { "name": "manuellehner", "key": "manuellehner", "displayName": "Manuel Lehner", "active": true, "timeZone": "Europe/Berlin" }, "created": "2016-02-18T13:57:21.000+0000", "updated": "2016-02-18T13:57:21.000+0000" }, { "id": "377228", "author": { "name": "falko", "key": "falko", "displayName": "Andrey Tkachenko", "active": true, "timeZone": "Europe/Moscow" }, "body": "[PR|https://github.com/appcelerator/titanium_mobile/pull/7753]", "updateAuthor": { "name": "falko", "key": "falko", "displayName": "Andrey Tkachenko", "active": true, "timeZone": "Europe/Moscow" }, "created": "2016-02-18T14:17:45.000+0000", "updated": "2016-02-18T14:18:04.000+0000" }, { "id": "377310", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "[~falko] Thanks for the PR. Putting this in a sprint that's coming right up to get this reviewed.", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2016-02-19T02:37:34.000+0000", "updated": "2016-02-19T02:37:34.000+0000" }, { "id": "377720", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "Additional test to run from TIMOB-18956 :-\r\n{code}\r\nvar win = Titanium.UI.createWindow({ \r\n title:'Window',\r\n backgroundColor:'#fff'\r\n});\r\n \r\nwin.orientationModes = [ \r\n Titanium.UI.PORTRAIT, \r\n Titanium.UI.UPSIDE_PORTRAIT,\r\n Titanium.UI.LANDSCAPE_LEFT,\r\n\tTitanium.UI.LANDSCAPE_RIGHT\r\n];\r\n \r\nTi.Gesture.addEventListener('orientationchange', function(e){\r\n switch(e.orientation) {\r\n case Ti.UI.LANDSCAPE_RIGHT:\r\n Ti.API.info(\"LANDSCAPE_RIGHT\");\r\n\t\tTi.UI.createNotification({\r\n\t \tmessage:\"LANDSCAPE_RIGHT\",\r\n\t \tduration: Ti.UI.NOTIFICATION_DURATION_SHORT\r\n\t\t}).show();\r\n break;\r\n case Ti.UI.LANDSCAPE_LEFT:\r\n Ti.API.info(\"LANDSCAPE_LEFT\");\r\n\t\tTi.UI.createNotification({\r\n\t \tmessage:\"LANDSCAPE_LEFT\",\r\n\t \tduration: Ti.UI.NOTIFICATION_DURATION_SHORT\r\n\t\t}).show();\r\n break;\r\n case Ti.UI.UPSIDE_PORTRAIT:\r\n Ti.API.info(\"UPSIDE_PORTRAIT\");\r\n\t\tTi.UI.createNotification({\r\n\t \tmessage:\"UPSIDE_PORTRAIT\",\r\n\t \tduration: Ti.UI.NOTIFICATION_DURATION_SHORT\r\n\t\t}).show();\r\n break;\r\n case Ti.UI.PORTRAIT:\r\n Ti.API.info(\"PORTRAIT\");\r\n\t\tTi.UI.createNotification({\r\n\t \tmessage:\"PORTRAIT\",\r\n\t \tduration: Ti.UI.NOTIFICATION_DURATION_SHORT\r\n\t\t}).show();\r\n break;\r\n default:\r\n Ti.API.info(\"Unknown!!\");\r\n\t} \r\n});\r\n \r\nwin.open();\r\n{code}", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2016-02-24T05:47:49.000+0000", "updated": "2016-02-24T05:47:49.000+0000" }, { "id": "377721", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "PR merged into 5_2_X (https://github.com/appcelerator/titanium_mobile/pull/7753)\r\n\r\nCherry-picked commit to master: https://github.com/appcelerator/titanium_mobile/pull/7774", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2016-02-24T06:17:41.000+0000", "updated": "2016-02-24T06:19:11.000+0000" }, { "id": "377722", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "[~falko] Thank you.", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2016-02-24T06:18:45.000+0000", "updated": "2016-02-24T06:18:45.000+0000" }, { "id": "378723", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified the memory leak with SDK 5.2.1.v20160303112058. After opening the window 10 times & closing all but the first I still see 7 windowProxy objects in the heap dump.\r\n\r\nReopening.\r\n\r\nEnvironment:\r\nAppc Studio : 4.5.0.201602170831\r\nTi SDK : 5.2.1.v20160303112058\r\nTi CLI : 5.0.6\r\nAlloy : 1.7.33\r\nMAC El Capitan : 10.11.13\r\nAppc NPM : 4.2.3\r\nAppc CLI : 5.2.0\r\nNode: 4.2.2\r\nNexus 6P - Android 6.0.1", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-03-03T23:58:53.000+0000", "updated": "2016-03-03T23:58:53.000+0000" }, { "id": "378738", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "[~lchoudhary] I tried it with master branch 5_2_X and not able to see 7 windowProxy objects leaking.\r\nCould you share the code you are using that would result in that? Is there any difference?", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2016-03-04T03:41:21.000+0000", "updated": "2016-03-04T03:41:21.000+0000" }, { "id": "378792", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-03-04T19:10:48.000+0000", "updated": "2016-03-04T19:10:48.000+0000" }, { "id": "378874", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "[~lchoudhary] I tried it with 5.2.1.v20160303112058 and found no issues.\r\nI think you might have missed just one final step in the test.\r\nAfter closing everything, the objects will still be there until you `Cause GC`. It won't be collected immediately. Please press `Cause GC` in the Android Device Monitor and then get the hprof. This should result in the items being collected and no objects leaking.\r\n\r\nIf this is the cause, and you can verify that this works, please resolve this ticket. :)\r\n\r\nIf not, please let me know. I've tried it by creating a hprof file before, after and after GC and found it to be working correctly with proxy objects 1, 10 and 1 respectively. Works correctly for me. ", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2016-03-07T04:22:12.000+0000", "updated": "2016-03-07T04:22:12.000+0000" }, { "id": "378875", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "I'm using a Nexus 6 with Android 6.0.", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2016-03-07T04:22:28.000+0000", "updated": "2016-03-07T04:22:28.000+0000" }, { "id": "378907", "author": { "name": "falko", "key": "falko", "displayName": "Andrey Tkachenko", "active": true, "timeZone": "Europe/Moscow" }, "body": "I changed my test code from description. And tested it with 5.1.2 (patched with my PR from here). I opened windows up to \"Window #10\" and pushed to the GC button until memory stabilized.\r\n\r\nUpdated code (from description):\r\n{code:javascript}\r\n(function openWindow(n) {\r\n\tvar win = Ti.UI.createWindow({\r\n\t\tbackgroundColor : \"#aaaaaa\",\r\n\t\tlayout : \"vertical\"\r\n\t});\r\n\r\n\twin.title = \"Window # \" + n;\r\n\r\n\tvar label = Ti.UI.createLabel({\r\n\t\ttext : \"Window # \" + n,\r\n\t\tcolor : \"#ffffff\",\r\n\t\ttop : 20\r\n\t});\r\n\r\n\twin.add(label);\r\n\tlabel = null;\r\n\r\n\tvar openButton = Ti.UI.createButton({\r\n\t\ttitle : \"Open\",\r\n\t\tcolor : \"#ffffff\",\r\n\t\ttop : 20,\r\n\t\t_n: n\r\n\t});\r\n\r\n\topenButton.addEventListener('click', function onOpenByButton(evt) {\r\n\t\topenWindow(evt.source._n + 1);\r\n\t});\r\n\r\n\twin.add(openButton);\r\n\topenButton = null;\r\n\r\n\tvar closeButton = Ti.UI.createButton({\r\n\t\ttitle : \"Close\",\r\n\t\tcolor : \"#ffffff\",\r\n\t\ttop : 20\r\n\t});\r\n\r\n\tcloseButton.addEventListener('click', function onCloseByButton(evt) {\r\n\t\tevt.source.getParent().close();\r\n\t});\r\n\r\n\twin.add(closeButton);\r\n\tcloseButton = null;\r\n\twin.open();\r\n\twin = null;\r\n})(1);\r\n\r\n{code}\r\n\r\nScreenshot: https://yadi.sk/i/AhGS0fDCpxgih\r\n*Please replace link to image*\r\n\r\nI think something wrong with closing process of Activities. Please spend time to find and fix it. \r\nSituation is compounded when we have more complex views hierarchy.\r\n\r\nI redid a lot of test for that in alloy and I found that many objects remains in memory for each Window that opend at least once. If you have many other windows\r\nthis substantially.", "updateAuthor": { "name": "falko", "key": "falko", "displayName": "Andrey Tkachenko", "active": true, "timeZone": "Europe/Moscow" }, "created": "2016-03-07T10:23:49.000+0000", "updated": "2016-03-07T11:10:23.000+0000" }, { "id": "379036", "author": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~msamah], Thanks, getting hprof after GC reduced the objects to 1or 2 instead of 7.\r\n\r\nResolving the ticket & closing.\r\n\r\nEnvironment:\r\nAppc Studio : 4.5.0.201602170831\r\nTi SDK : 5.2.1.v20160303223838\r\nTi CLI : 5.0.6\r\nAlloy : 1.7.33\r\nMAC El Capitan : 10.11.13\r\nAppc NPM : 4.2.3\r\nAppc CLI : 5.2.0\r\nNode: 4.2.2\r\nNexus 6P - Android 6.0.1", "updateAuthor": { "name": "lchoudhary", "key": "lchoudhary", "displayName": "Lokesh Choudhary", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-03-07T19:04:04.000+0000", "updated": "2016-03-07T19:04:04.000+0000" }, { "id": "379107", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "[~falko] I presume you are implying that there is something else that is leaking that is not in the original PR that you did? Is there a difference with alloy and classic as mentioned by you?", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2016-03-08T02:58:27.000+0000", "updated": "2016-03-08T02:58:27.000+0000" }, { "id": "379246", "author": { "name": "falko", "key": "falko", "displayName": "Andrey Tkachenko", "active": true, "timeZone": "Europe/Moscow" }, "body": "@Ashraf Abu Yes there is something else besides my PR. I am not developing classic app, and you can see in my previevs comment that some objects remained in memory.\r\nIn Alloy we are use BaseController that holds references to the views. I think TiActivity is destroyed before controller instance and this may be the reason activity and its children views are not processed by GC. Something holds references to the native views.\r\n\r\nFor exemple look at https://yadi.sk/i/r1gxTIs4pzJcT\r\nApp: https://yadi.sk/d/WICFdTLPpzK3U\r\n\r\nStep to reproduce:\r\nRun in Android\r\n\r\n1. GC, GC, GC, Create dump 1\r\n2. Click to \"Open win1\"\r\n3. Close with Back button\r\n4. Click to \"Open win2\"\r\n5. Close with Back button\r\n6. Click to \"Open win3\"\r\n7. Close with Back button\r\n8. Click to \"Open win2\"\r\n9. Close with Back button\r\n10. Click to \"Open win1\"\r\n11. Close with Back button\r\n12. GC, GC, GC, Create dump 2", "updateAuthor": { "name": "falko", "key": "falko", "displayName": "Andrey Tkachenko", "active": true, "timeZone": "Europe/Moscow" }, "created": "2016-03-08T20:19:03.000+0000", "updated": "2016-03-08T20:19:03.000+0000" } ], "maxResults": 36, "total": 36, "startAt": 0 } } }