{ "id": "169650", "key": "AC-5161", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "12217", "key": "AC", "name": "Appcelerator - INBOX", "projectCategory": { "id": "10000", "description": "", "name": "Customer Service" } }, "resolution": { "id": "2", "description": "The problem described is an issue which will never be fixed.", "name": "Won't Fix" }, "resolutiondate": "2017-10-17T19:55:26.000+0000", "created": "2017-08-28T10:05:55.000+0000", "labels": [ "memoryleak" ], "versions": [], "issuelinks": [], "assignee": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "updated": "2017-10-17T19:55:26.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": "14544", "name": "Alloy", "description": "Please enter tickets related to the Alloy here." }, { "id": "14548", "name": "Titanium SDK & CLI", "description": "Please enter tickets related to the MobileSDK here." } ], "description": "I have the following basic Titanium Alloy application:\r\n\r\n*index.xml*\r\n{code:php}\r\n \r\n \t\r\n \t\t\r\n \t\r\n \r\n{code}\r\n\r\n*index.js*\r\n\r\n{code:php}\r\n function doClick(e) {\r\n \tAlloy.createController('foo', {}).getView().open();\r\n }\r\n \r\n $.index.open();\r\n{code}\r\n\r\n*foo.xml*\r\n\r\n{code:php}\r\n \r\n \t\r\n \t\t\r\n \t\t\t\r\n \t\t\r\n \t\r\n \r\n{code}\r\n\r\n\r\n*foo.js*\r\n\r\n{code:php}\r\n $.cleanup = function cleanup() {\r\n $.destroy();\r\n $.off();\r\n $.foo.removeEventListener('close', $.cleanup); // added per @Sharif AbuDarda suggestion\r\n };\r\n \r\n $.foo.addEventListener('close', $.cleanup);\r\n{code}\r\n\r\nI then monitored the amount of memory the Android emulator was using DDMS, based on the instructions provided here: http://docs.appcelerator.com/platform/latest/#!/guide/Managing_Memory_and_Finding_Leaks\r\n\r\nWhen the application started the number of objects was: *32,188*\r\n\r\nWhen I click the button, and then close the new window by pressing back, the number of objects increases to: *32,332*\r\n\r\nI do this again, it increases to: *32,478*\r\n\r\nOpen and close the window about 8 more times, and it increases to: *34,481*\r\n\r\nand so on.\r\n\r\nThe issue is even worse if the window has many objects.\r\n\r\nNote I have tested this on both an Android Emulator (Nexus 4) and a real Android device (Samsung S6).\r\nThis issues seems to occur on *6.1.X GA*\r\n\r\nNOTE: I have not yet tested this on iOS yet.", "attachment": [], "flagged": false, "summary": "Memory leak in Hello World application", "creator": { "name": "yahya12", "key": "yahya12", "displayName": "Yahya Uddin", "active": true, "timeZone": "Europe/London" }, "subtasks": [], "reporter": { "name": "yahya12", "key": "yahya12", "displayName": "Yahya Uddin", "active": true, "timeZone": "Europe/London" }, "environment": "Alloy 6.1.2GA\r\nAndroid Emulator, Nexus 4\r\nAndroid Real Device: Samsung S6\r\n", "comment": { "comments": [ { "id": "427356", "author": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "body": "Hello, The evidence you showed showing a little memory increase. This much is usually negligible. Also, remove any event in the window before closing window. Thanks.", "updateAuthor": { "name": "sdarda", "key": "sdarda", "displayName": "Sharif AbuDarda", "active": false, "timeZone": "Asia/Dhaka" }, "created": "2017-08-29T15:31:05.000+0000", "updated": "2017-08-29T15:31:05.000+0000" }, { "id": "427383", "author": { "name": "yahya12", "key": "yahya12", "displayName": "Yahya Uddin", "active": true, "timeZone": "Europe/London" }, "body": "Note that removing the event listener did not seem to fix the issue", "updateAuthor": { "name": "yahya12", "key": "yahya12", "displayName": "Yahya Uddin", "active": true, "timeZone": "Europe/London" }, "created": "2017-08-29T22:21:53.000+0000", "updated": "2017-08-29T22:21:53.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }