{ "id": "132252", "key": "TIMOB-17479", "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": [], "resolution": { "id": "5", "description": "All attempts at reproducing this issue failed, or not enough information was available to reproduce the issue. Reading the code produces no clues as to why this behavior would occur. If more information appears later, please reopen the issue.", "name": "Cannot Reproduce" }, "resolutiondate": "2017-06-11T17:47:04.000+0000", "created": "2014-06-25T22:41:13.000+0000", "priority": { "name": "None", "id": "6" }, "labels": [ "TCSupport", "ios" ], "versions": [ { "id": "15422", "description": "Release 3.3.0", "name": "Release 3.3.0", "archived": false, "released": true, "releaseDate": "2014-07-16" } ], "issuelinks": [], "assignee": null, "updated": "2018-02-28T20:04:09.000+0000", "status": { "description": "A resolution has been taken, and it is awaiting verification by reporter. From here issues are either reopened, or are closed.", "name": "Resolved", "id": "5", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "h5. Problem Description \r\nThe TiUIListViewProxy is never released and the memory usage keeps increasing with Titanium SDK 3.3.0 and 3.2.X.GA. It’s a valid bug. \r\n \r\nh5. Testing Environment:\r\n \r\nMac OS X 10.9\r\nTi CLI 3.3.0\r\nTitanium SDK: 3.3.0.RC and 3.2.X.GA\r\niOS 7.1\r\n \r\nh5. Test Code \r\n\r\n{code}\r\n\r\n// This is a single context application with multiple windows in a stack\r\n(function() {\r\n\r\nvar createTableWin = function(){\r\n\tvar tableWin = Ti.UI.createWindow({backgroundColor: 'white'});\r\n\r\n\tvar myTemplate = {\r\n\t childTemplates: [\r\n\t {\r\n\t type: 'Ti.UI.Label',\r\n\t bindId: 'titleLabel',\r\n\t properties: {\r\n\t width: '50%',\r\n\t height: '100%',\r\n\t left: '0dp'\r\n\t }\r\n\t },\r\n\t {\r\n\t type: 'Ti.UI.TextField',\r\n\t bindId: 'textfield',\r\n\t properties: {\r\n\t \twidth: '49.5%',\r\n\t\t\t\t\tright: '0dp',\r\n\t\t\t\t\tborderStyle: Ti.UI.INPUT_BORDERSTYLE_ROUNDED\r\n\t },\r\n\t events: {\r\n\t\t\t\t\tfocus: function(event) {\r\n\r\n\t\t\t\t\t},\r\n\t\t\t\t\tblur: function(event) {\r\n\t\t\t\t\t\tvar sections = [];\r\n\t\t\t\t\t\tvar fruitSection = Ti.UI.createListSection({ headerTitle: 'Fruits / Frutas'});\r\n\t\t\t\t\t\tvar fruitDataSet = [\r\n\t\t\t\t\t\t { titleLabel: {text: 'Apple'}},\r\n\t\t\t\t\t\t { titleLabel: {text: 'Banana'}},\r\n\t\t\t\t\t\t { titleLabel: {text: 'One more item'}}\r\n\t\t\t\t\t\t];\r\n\t\t\t\t\t\tfruitSection.setItems(fruitDataSet);\r\n\t\t\t\t\t\tsections.push(fruitSection);\r\n\t\t\t\t\t\tlistView.setSections(sections);\r\n\t\t\t\t\t},\r\n\t\t\t\t\tchange: function(event) {\r\n\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t }\r\n\t ]\r\n\t};\r\n\r\n\tvar listView = Ti.UI.createListView({\r\n\t templates: { 'template': myTemplate },\r\n\t defaultItemTemplate: 'template'\r\n\t});\r\n\tvar sections = [];\r\n\r\n\r\n\r\n\tvar fruitSection = Ti.UI.createListSection({ headerTitle: 'Fruits / Frutas'});\r\n\tvar fruitDataSet = [\r\n\t { titleLabel: {text: 'Apple'}},\r\n\t { titleLabel: {text: 'Banana'}}\r\n\t];\r\n\tfruitSection.setItems(fruitDataSet);\r\n\tsections.push(fruitSection);\r\n\r\n\tlistView.setSections(sections);\r\n\ttableWin.add(listView);\r\n\r\n\treturn tableWin;\r\n};\r\n\r\n//empty root win\r\nvar rootWin = Ti.UI.createWindow({backgroundColor: 'white'});\r\nvar leftButton = Ti.UI.createButton({\r\n\ttitle: 'open'\r\n});\r\nleftButton.addEventListener('click', function(){\r\n\tiosNav.openWindow(createTableWin());\r\n});\r\nrootWin.setLeftNavButton(leftButton);\r\n\r\n\r\n\r\nvar iosNav = Ti.UI.iOS.createNavigationWindow({\r\n\twindow: rootWin\r\n});\r\niosNav.open();\r\n\r\n\r\n})();\r\n\r\n{code}\r\n\r\nh5. Steps To Test\r\n \r\n- Create a new project\r\n- Update app.js file with sample code\r\n- Run on iPad simulator 7.1\r\n- Test allocation summary for running 10 times\r\n- Memory usage keeps increasing.\r\n\r\nScreenshot: https://www.dropbox.com/s/jn0xsh5rltbrbao/Screen%20Shot.jpg\r\n\r\n \r\nh5. Expected Result\r\n \r\nIt’s not working as expected.\r\n", "attachment": [ { "id": "49280", "filename": "app.js", "author": { "name": "kagachan", "key": "kagachan", "displayName": "Kaga", "active": true, "timeZone": "Pacific/Auckland" }, "created": "2014-06-25T22:41:13.000+0000", "size": 2081, "mimeType": "application/x-javascript" } ], "flagged": false, "summary": "iOS: Memory leak when ListView template contains an event listener that update the listview", "creator": { "name": "kagachan", "key": "kagachan", "displayName": "Kaga", "active": true, "timeZone": "Pacific/Auckland" }, "subtasks": [], "reporter": { "name": "kagachan", "key": "kagachan", "displayName": "Kaga", "active": true, "timeZone": "Pacific/Auckland" }, "environment": "Ti SDK 3.2.3, OSX 10.9, Xcode 5.1.1, iOS 7.1\r\nTi SDK 3.3.0.GA", "comment": { "comments": [ { "id": "317843", "author": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "body": "Thanks for your report. The Platform team will set the priority on this issue. ", "updateAuthor": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "created": "2014-08-10T07:43:11.000+0000", "updated": "2014-08-10T07:43:11.000+0000" }, { "id": "317964", "author": { "name": "FrancoisM", "key": "francoism", "displayName": "François Mériaux", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I met the same issue. It only appears when the templates include event listeners.\r\n\r\nAs a workaround, I removed the listeners from the templates and I set a listener to the 'itemclick' event on the ListView. Then I recognize which element had been clicked by playing with bindID and itemIndex of the source. Something like:\r\n\r\n{code:javascript}\r\nfunction manageClick(e) {\r\n\tTi.API.debug('in profile detail, click spotted on listview');\r\n\tif (e.itemIndex === startActivitiesIndex) {\r\n\t\tif (e.bindId) {\r\n\t\t\tif ((e.bindId === 'bleftChevronBox') || (e.bindId === 'bfaLeftChevron')) {\r\n\t\t\t\tloadPreviousActivities();\r\n\t\t\t} else if ((e.bindId === 'brightChevronBox') || (e.bindId === 'bfaRightChevron')) {\r\n\t\t\t\tloadNextActivities();\r\n\t\t\t} else if ((e.bindId === 'bleftTitleBox') || (e.bindId === 'bfaClock')) {\r\n\t\t\t\tsortByTimestamp(function() {\r\n\t\t\t\t});\r\n\t\t\t} else if ((e.bindId === 'brightTitleBox') || (e.bindId === 'bfaComment')) {\r\n\t\t\t\tsortByCommentTimestamp(function() {\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}\r\n$.listview.addEventListener('itemclick', manageClick);\r\n{code}\r\n\r\nThis way, the memory leak does not occur.", "updateAuthor": { "name": "FrancoisM", "key": "francoism", "displayName": "François Mériaux", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-08-11T15:22:49.000+0000", "updated": "2014-08-11T15:41:14.000+0000" }, { "id": "317987", "author": { "name": "bcproductions", "key": "bcproductions", "displayName": "Ed", "active": true, "timeZone": "America/Havana" }, "body": "I'm seeing this memory leak as well on my app. I also try to use the listview's 'itemclick' event as a workaround whenever possible (as suggested by François above), but it does not work for non-click events, like 'change', 'selected', etc. Hoping we can get a fix on the next 3.3.1, as my app uses several templated listviews. Thanks.", "updateAuthor": { "name": "bcproductions", "key": "bcproductions", "displayName": "Ed", "active": true, "timeZone": "America/Havana" }, "created": "2014-08-11T16:23:04.000+0000", "updated": "2014-08-11T16:23:04.000+0000" }, { "id": "347123", "author": { "name": "jonasfunk", "key": "jonasfunk", "displayName": "Jonas Funk Johannessen", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Me too. ItemTemplate with event will not clear the proxies. Hoping this PR will help fix this issue. https://github.com/appcelerator/alloy/pull/671", "updateAuthor": { "name": "jonasfunk", "key": "jonasfunk", "displayName": "Jonas Funk Johannessen", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-03-24T10:40:21.000+0000", "updated": "2015-03-24T10:40:21.000+0000" }, { "id": "421707", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "I am unable to reproduce this leak in Titanium SDK 6.0+, testing with Instruments and the Allocations instrument.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-06-11T17:47:04.000+0000", "updated": "2017-06-11T17:47:04.000+0000" } ], "maxResults": 7, "total": 7, "startAt": 0 } } }