{ "id": "121047", "key": "ALOY-847", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "11113", "key": "ALOY", "name": "Alloy", "projectCategory": { "id": "10400", "description": "Tools for developing applications", "name": "Tooling" } }, "fixVersions": [ { "id": "15816", "description": "2014 Sprint 02", "name": "2014 Sprint 02", "archived": true, "released": true, "releaseDate": "2014-01-31" } ], "resolution": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2014-01-21T21:35:48.000+0000", "created": "2013-10-10T14:08:45.000+0000", "priority": { "name": "Low", "id": "4" }, "labels": [ "Alloy", "Android" ], "versions": [], "issuelinks": [], "assignee": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "updated": "2014-02-03T18:39:30.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": "13610", "name": "Builtins", "description": "Builtin Javascript libraries" } ], "description": "Hello,\r\n\r\nI have been chasing memory leaks and trying to improve memory management in my app. (I use a lot of bitmaps in my app.)\r\nI recently learnt how to use eclipse MAT and discovered a +-1.5 MB bitmap leaking in my app.\r\n\r\nIn the end I did a really simple test:\r\n\r\n* Create a new classic titanium project without changing anything. Then analyze heap dump.\r\n* The same with a new Alloy project.\r\n\r\nDifference between both is around 1.5 MB: the bitmap size I've mentioned before.\r\n\r\nI suspect Alloy is trapping an image when the app launches. The only image I can come with is the one for the splash screen but I don't really know.\r\n\r\nI'll add some screens. If you want to try to reproduce the test it's easy. Just create two new projects like I did. It was tested with Titanium SDK 3.1.2GA Alloy 1.2.2", "attachment": [ { "id": "45271", "filename": "alloy.png", "author": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "created": "2014-01-21T21:30:28.000+0000", "size": 231602, "mimeType": "image/png" }, { "id": "45272", "filename": "classic no title.png", "author": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "created": "2014-01-21T21:30:28.000+0000", "size": 206206, "mimeType": "image/png" }, { "id": "45273", "filename": "classic with title.png", "author": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "created": "2014-01-21T21:30:28.000+0000", "size": 191911, "mimeType": "image/png" }, { "id": "43080", "filename": "Screen Shot 2013-10-10 at 15.07.31.png", "author": { "name": "aodev", "key": "aodev", "displayName": "Kevin Purnelle", "active": true, "timeZone": "Europe/Berlin" }, "created": "2013-10-10T14:08:45.000+0000", "size": 79576, "mimeType": "image/png" }, { "id": "43081", "filename": "Screen Shot 2013-10-10 at 15.24.19.png", "author": { "name": "aodev", "key": "aodev", "displayName": "Kevin Purnelle", "active": true, "timeZone": "Europe/Berlin" }, "created": "2013-10-10T14:08:45.000+0000", "size": 66131, "mimeType": "image/png" }, { "id": "43082", "filename": "Screen Shot 2013-10-10 at 15.30.45.png", "author": { "name": "aodev", "key": "aodev", "displayName": "Kevin Purnelle", "active": true, "timeZone": "Europe/Berlin" }, "created": "2013-10-10T14:08:45.000+0000", "size": 77106, "mimeType": "image/png" } ], "flagged": false, "summary": "Could this be a memory leak in Alloy ? (bitmap trapped / Android)", "creator": { "name": "aodev", "key": "aodev", "displayName": "Kevin Purnelle", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "aodev", "key": "aodev", "displayName": "Kevin Purnelle", "active": true, "timeZone": "Europe/Berlin" }, "environment": "Android Phone HTC Sensation (cyanogenmod, Android 4.2.2) Ti SDK 3.1.2GA\r\n", "closedSprints": [ { "id": 27, "state": "closed", "name": "2014 Sprint 02", "startDate": "2014-01-21T21:11:26.602Z", "endDate": "2014-02-02T21:11:26.602Z", "completeDate": "2014-02-04T17:28:27.509Z" } ], "comment": { "comments": [ { "id": "275118", "author": { "name": "aodev", "key": "aodev", "displayName": "Kevin Purnelle", "active": true, "timeZone": "Europe/Berlin" }, "body": "Sorry here I can not add a title to screenshot. From left to right:\r\n1) and 2) with Alloy. 3) Classic Ti app (no bitmap found there)", "updateAuthor": { "name": "aodev", "key": "aodev", "displayName": "Kevin Purnelle", "active": true, "timeZone": "Europe/Berlin" }, "created": "2013-10-15T12:06:46.000+0000", "updated": "2013-10-15T12:07:31.000+0000" }, { "id": "275151", "author": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Does this \"leak\" grow over time? It appears that it does not, nor that it affects anything else. Is it just this 1.5 MB image you're worried about?", "updateAuthor": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-10-15T16:48:17.000+0000", "updated": "2013-10-15T16:48:17.000+0000" }, { "id": "275157", "author": { "name": "aodev", "key": "aodev", "displayName": "Kevin Purnelle", "active": true, "timeZone": "Europe/Berlin" }, "body": "In my particular case I'm having a serious problem with images being trapped somehow in Android. But I can't find where, except they are kept referenced in some LruImageCache object. (will be for Q&A soon :))\r\n\r\nBut, this crashes the app after a while. (quite soon actually)\r\n\r\nIt is true, I suppose, that these 1,5 MB are constant and this won't crash an app.\r\n\r\nBut while I was investigating what happens with my code, I found this issue. So I don't know if it's ok or not, to have these 1,5MB taken. I just prefer to mention it.\r\n\r\nMy personal thought on the subject: it's 10% of max heap for Android prior to v3 for what I've read (16MB) (24 MB in recent devices), so it's something. And if it's really a \"bug\" it still reduces Alloy footprint quite a lot if resolved. With my recent issues, I saw it's easy for an app to crash just because of some bad memory management with images. (quite common problem in Android for what I've seen)\r\n\r\nThat said, is it really worth it? is it really a leak? for that I don't know enough actually to know if I should worry or not.", "updateAuthor": { "name": "aodev", "key": "aodev", "displayName": "Kevin Purnelle", "active": true, "timeZone": "Europe/Berlin" }, "created": "2013-10-15T17:44:28.000+0000", "updated": "2013-10-15T17:44:28.000+0000" }, { "id": "289124", "author": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "body": "monitor screens attached", "updateAuthor": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "created": "2014-01-21T21:30:28.000+0000", "updated": "2014-01-21T21:30:28.000+0000" }, { "id": "289126", "author": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "body": "I tested this and find a negligible difference between Alloy and Classic projects, provided the same app is built for both.\n\n * Project 1: Alloy, default 1-page app with centered label and window title\n * Project 2: Classic, default 1-page app using boilerplate code, no window title\n * Project 3: Classic, hand-coded to match Alloy app, centered label and window title, same click event listener\n\nProject 1 and 2 shows roughly 1.5 MB difference in heap use as reported. However, the apps are different because the default classic app has no window title (ActionBar)\n\nProjects 1 and 3 show very similar heap use, as shown in the screens I attached. ", "updateAuthor": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "created": "2014-01-21T21:35:25.000+0000", "updated": "2014-01-21T21:35:25.000+0000" }, { "id": "289127", "author": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "body": "None of these apps showed growth over time. While the Alloy app uses a small amount of extra heap, the difference is small. There is no memory leak caused by Alloy.", "updateAuthor": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "created": "2014-01-21T21:35:48.000+0000", "updated": "2014-01-21T21:35:48.000+0000" } ], "maxResults": 6, "total": 6, "startAt": 0 } } }