{ "id": "108200", "key": "TIMOB-12405", "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": "15275", "description": "2013 Sprint 04 Core", "name": "2013 Sprint 04 Core", "archived": true, "released": true, "releaseDate": "2013-02-25" }, { "id": "14814", "description": "2013 Sprint 04", "name": "2013 Sprint 04", "archived": true, "released": true, "releaseDate": "2013-02-25" } ], "resolution": { "id": "3", "description": "The problem is a duplicate of an existing issue.", "name": "Duplicate" }, "resolutiondate": "2013-02-14T22:13:38.000+0000", "created": "2013-01-21T12:11:09.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "android", "module" ], "versions": [ { "id": "13505", "description": "Release 3.0.0", "name": "Release 3.0.0", "archived": true, "released": true, "releaseDate": "2012-12-14" } ], "issuelinks": [ { "id": "25853", "type": { "id": "10122", "name": "Gantt: start-finish", "inward": "is triggered by", "outward": "is triggering" }, "inwardIssue": { "id": "107871", "key": "TIMOB-12286", "fields": { "summary": "Android: Memory leak when backing out and coming back to an app", "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": "High", "id": "2" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } }, { "id": "25854", "type": { "id": "10122", "name": "Gantt: start-finish", "inward": "is triggered by", "outward": "is triggering" }, "inwardIssue": { "id": "107881", "key": "TIMOB-12289", "fields": { "summary": "Android: Memory leak when a view event listener references a parent", "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": "High", "id": "2" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-03-21T22:42:09.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": "Hi,\r\n\r\nThese are the steps to reproduce the problem:\r\n\r\n1. Open Titanium Studio \r\n2. Create a new app w/ the Single Window app template\r\n3. Project OS target: only Android checkbox, and no cloud settings. \r\nName and id, whatever.\r\nSDK 3.0.0.GA (check others possibilites in environment field)\r\n4. Once created, open tiapp and replace 'android' node with this:\r\n{code:xml} \r\n \r\n \r\n \r\n \r\n \r\n{code}\r\n(this let us trace memory with MAT when deoployed to real device)\r\n5. Clean & run the app in the emulator / device (although no matter what you do as we'll see the same behaviour).\r\n6. Once deployed, change to DDMS perspective.\r\n7. In devices list, highlight our (device and) app process.\r\n8. Click the 'Update HEAP' button.\r\n9. Now run - quit (back button) - run X times.\r\n10. In Heap tab, click \"Cause GC\" button a few times until you see memory indicators stable.\r\n11. Click \"Dump HPROF file\" button, and get object Histogram with MAT.\r\n12. Search for Class Name regex typing 'Module'. \r\n\r\nNow see X objects of each Titanium module; you can go deeper:\r\n\r\n13. Right click on any of the Histogram lines > List objects > with incoming references\r\n14. Right click on any item from list_objects > Path to GC Roots > Exclude all phantom/weak/soft etc. references\r\n\r\nThen you'll see only one Native Stack GC Root, which I guess the memory is retained inside 'JNI land'.\r\n\r\nI've tried this with ALL the environment variables I've specified in this ticket enviroment field, with almost all possible combinations, and always get the same result. I've also attached screenshots and even tried this with a very very simple app! (https://gist.github.com/4585261)\r\n\r\nThere's more: it also happens with custom modules. Actually, while I was developing my GCM module I realized that 'something' memory related was happening. Just a few lines: the module has a method (registerForPushNotifications) which has a js object as an argument, and its properties are function callbacks... in Java land those callbacks are really KrollCallback, as you may guess. When the method is executed, the callbacks are assigned to instance KrollCallback private properties. When the module has been integrated into an existing app, it worked as expected BUT after some tests something really weird happened: callbacks were fired, but the logic inside reported a wrong state (e.g. logging out a counter variable shown wrong values). After tons of tests, I made the KrollCallback properties static, and it 'solved' the problem.\r\nI'm not one of those who always think that it's fault of the underlying framework / SDK, so 1st thing I thought was I was doing some bad memory management, retaining whatever. No way... I commented everything until make the module useless, doing nothing... and even without making a single require of the module in JS land, MAT shown X Module objects. \r\nI also thought that it really wasn't a bug, just some MAT understandable memory thing... but definitely the wrong behaviour with my module solved making static properties made me think the opposite.\r\n\r\nFinally (and I don't know if it has something to do) I've also attached a screenshot of logcat output with mysterious messages: \r\n01-21 10:43:09.467: W/TiApplication(2479): (KrollRuntimeThread) [312,312] Registering module with name already in use.\r\n\r\nIf this is not a bug, I'll really appreciate a technical explanation of what is happening, why MAT is reporting X instances of Ti / custmo modules. But, if it IS a bug, IMHO must be considered a serious bug, and I really hope it'll be solved very soon.", "attachment": [ { "id": "34920", "filename": "Screen Shot 2013-01-21 at 12.05.36.png", "author": { "name": "iamyellow", "key": "iamyellow", "displayName": "jordi domenech", "active": true, "timeZone": "Europe/Berlin" }, "created": "2013-01-21T12:11:10.000+0000", "size": 109117, "mimeType": "image/png" }, { "id": "34921", "filename": "Screen Shot 2013-01-21 at 12.05.55.png", "author": { "name": "iamyellow", "key": "iamyellow", "displayName": "jordi domenech", "active": true, "timeZone": "Europe/Berlin" }, "created": "2013-01-21T12:11:10.000+0000", "size": 70968, "mimeType": "image/png" }, { "id": "34922", "filename": "Screen Shot 2013-01-21 at 12.06.04.png", "author": { "name": "iamyellow", "key": "iamyellow", "displayName": "jordi domenech", "active": true, "timeZone": "Europe/Berlin" }, "created": "2013-01-21T12:11:10.000+0000", "size": 40768, "mimeType": "image/png" }, { "id": "34923", "filename": "Screen Shot 2013-01-21 at 12.22.11.png", "author": { "name": "iamyellow", "key": "iamyellow", "displayName": "jordi domenech", "active": true, "timeZone": "Europe/Berlin" }, "created": "2013-01-21T12:11:10.000+0000", "size": 143811, "mimeType": "image/png" } ], "flagged": false, "summary": "Android: Titanium object modules shown retained (Memory Analyzer Tool)", "creator": { "name": "iamyellow", "key": "iamyellow", "displayName": "jordi domenech", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "iamyellow", "key": "iamyellow", "displayName": "jordi domenech", "active": true, "timeZone": "Europe/Berlin" }, "environment": "* OS X 10.8.2\r\n* Titanium Studio, build: 3.0.1.201212181159, with latest Android tools installed:\r\n + Android Development Tools 21.0.1.v201212060256-543035\r\n + Android DDMS 21.0.1.v201212060256-543035\r\n + Memory Analyzer 1.0.1.201008091353\r\n\r\n--- SDKs tested ---\r\n\r\n* GA: 3.0.0, 2.0.2, 2.1.4\r\n* CI: 1.8.3.v20120529164726\r\n* Latest 3.1.0 built from sources\r\n\r\n--- HW tested ---\r\n\r\n* Samsung Nexus S, ICS 4.1.2\r\n* AVD, Google APIs 2.3.3, API level 10, armeabi", "comment": { "comments": [ { "id": "238626", "author": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "body": "This bug was resolved as a result of TIMOB-12289 & TIMOB-12286.", "updateAuthor": { "name": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-02-14T22:13:38.000+0000", "updated": "2013-02-14T22:13:38.000+0000" }, { "id": "414607", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as duplicate with reference to the above comments.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-21T22:42:09.000+0000", "updated": "2017-03-21T22:42:09.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }