{ "id": "98887", "key": "TIMOB-10351", "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": "13870", "description": "", "name": "Sprint 2012-16 API", "archived": true, "released": true, "releaseDate": "2012-08-13" }, { "id": "14096", "description": "Release 2.1.2", "name": "Release 2.1.2", "archived": true, "released": true, "releaseDate": "2012-08-31" }, { "id": "13505", "description": "Release 3.0.0", "name": "Release 3.0.0", "archived": true, "released": true, "releaseDate": "2012-12-14" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2012-08-14T16:21:48.000+0000", "created": "2012-08-08T12:30:54.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "core", "module_titanium", "qe-review", "qe-testadded" ], "versions": [ { "id": "13505", "description": "Release 3.0.0", "name": "Release 3.0.0", "archived": true, "released": true, "releaseDate": "2012-12-14" } ], "issuelinks": [], "assignee": { "name": "joshroesslein", "key": "joshroesslein", "displayName": "Josh Roesslein", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2012-09-11T09:49:40.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": "Timers on Android currently never release the callback function\r\nonce the timer has finished (fired once or was cancelled). A leak will\r\nbe created since the callback function and any objects it retains will never get collected.\r\n\r\nh3. Timer leak example\r\n\r\n{code:javascript}\r\nfunction startTimer() {\r\n // 1 mb buffer\r\n var buffer = Ti.createBuffer({length: 1024 * 1024});\r\n\r\n setTimeout(function() {\r\n alert('Buffer: length = ' + buffer.length);\r\n }, 2000);\r\n}\r\n\r\nvar win = Ti.UI.createWindow();\r\n\r\nvar startTimerButton = Ti.UI.createButton({title: 'Start timer'});\r\nstartTimerButton.addEventListener('click', startTimer);\r\nwin.add(startTimerButton);\r\n\r\nwin.open();\r\n{code}\r\n\r\n1. Run the test code and monitor the heap usage with DDMS.\r\n2. Click the \"Start timer\" button and wait for an alert.\r\n3. Dismiss the alert once it is shown and check the heap usage in DDMS.\r\n4. Repeat steps 2-3 and watch for heap growth.\r\n\r\nExpected: No long term growth in heap size should happen. It should reach a equilibrium.\r\nActual: The heap grows indefinitely eventually running out of memory.\r\n", "attachment": [], "flagged": false, "summary": "Android: Timers (setTimeout, setInterval) leak memory.", "creator": { "name": "joshroesslein", "key": "joshroesslein", "displayName": "Josh Roesslein", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "joshroesslein", "key": "joshroesslein", "displayName": "Josh Roesslein", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "213496", "author": { "name": "joshroesslein", "key": "joshroesslein", "displayName": "Josh Roesslein", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Created [PR #2703|https://github.com/appcelerator/titanium_mobile/pull/2703] to resolve issue.", "updateAuthor": { "name": "joshroesslein", "key": "joshroesslein", "displayName": "Josh Roesslein", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-08-08T20:29:46.000+0000", "updated": "2012-08-08T20:29:46.000+0000" }, { "id": "214479", "author": { "name": "joshroesslein", "key": "joshroesslein", "displayName": "Josh Roesslein", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Created [PR #2748|https://github.com/appcelerator/titanium_mobile/pull/2748] to back port fix into 2.1.2 release.", "updateAuthor": { "name": "joshroesslein", "key": "joshroesslein", "displayName": "Josh Roesslein", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-08-14T16:21:01.000+0000", "updated": "2012-08-14T16:21:01.000+0000" }, { "id": "214680", "author": { "name": "oromero", "key": "oromero", "displayName": "Olga Romero", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified fix with:\r\nTitanium Studio, build: 2.1.1.201207271312\r\nTitanium SDK: 2.1.2.v20120815081613\r\nDevices:\r\nDroid 2.2.3\r\nNexus7 4.1\r\nMac osx 10.8 Mountain Lion", "updateAuthor": { "name": "oromero", "key": "oromero", "displayName": "Olga Romero", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-08-15T15:36:34.000+0000", "updated": "2012-08-15T15:36:34.000+0000" } ], "maxResults": 3, "total": 3, "startAt": 0 } } }