{ "id": "64889", "key": "TIMOB-3799", "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": "11252", "name": "Sprint 2011-17", "archived": true, "released": true, "releaseDate": "2011-05-02" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2011-05-11T14:32:21.000+0000", "created": "2011-04-27T19:55:28.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [], "versions": [ { "id": "11243", "name": "Release 1.6.0 M10", "archived": true, "released": true, "releaseDate": "2011-02-21" } ], "issuelinks": [], "assignee": { "name": "rseagraves", "key": "rseagraves", "displayName": "Reggie Seagraves", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2011-05-11T14:32:21.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": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "If you use table.setData(rows); or table.data = rows; the rows that are being overwritten will be saved in memory.\n\nStep 1: run the code below\nStep 2: run Instruments search for proxy (see that #Living grows each time and does not release, should release)\nStep 3: click the 'Reset Data' button\nStep 4: notice that the number of 'Labels' and 'Rows' grows by 100 on every button click\n\n{code:javascript}\nTitanium.UI.setBackgroundColor('#000');\n\nvar win1 = Titanium.UI.createWindow({ \n title:'Tab 1',\n backgroundColor:'#fff'\n});\n\nfunction setRows(_start) {\n\n\tvar rows = [];\n\tvar end = _start + 100;\n\t\n\tfor(var i = _start; i < end; i++) {\n\t\tvar row\t\t= Ti.UI.createTableViewRow();\n\t\tvar label\t= Ti.UI.createLabel({ text: \"Test \" + i });\n\t\trow.add(label);\n\t\trows.push(row);\n\t}\n\n\treturn rows;\n}\n\nvar table = Ti.UI.createTableView({ \n\tdata: setRows(0) ,\n\tbottom: 70\n});\n\nvar button\t= Ti.UI.createButton({ \n\ttitle: \"Reset Data\",\n\theight: 50,\n\twidth: 200,\n\tbottom: 10 \n\t\n});\n\nvar click = 0;\nbutton.addEventListener(\"click\", function() {\n\tclick += 100;\n\t\t\t\n\ttable.setData(setRows(click));\n\t// table.data = setRows(click);\n});\n\nwin1.add(table);\nwin1.add(button);\nwin1.open();\n{code}\n\nh3. Workaround \nDid not work in (1.6.2). Worked with (1.7.0 Apr 27 2011 16:40 r3fb01972) here:\nhttp://builds.appcelerator.com.s3.amazonaws.com/mobile/master/mobilesdk-1.7.0-20110427164044-osx.zip\n\n{code:javascript}\nwin1.remove(table);\ntable = null;\n\t\t\t\ntable = Ti.UI.createTableView({ \n\tdata: setRows(click) ,\n\tbottom: 70\n});\nwin1.add(table);\n{code}", "attachment": [], "flagged": false, "summary": "iOS: in tableView using setData(rows) and data = rows to set the rows keeps all of the previous rows in memory", "creator": { "name": "jalter", "key": "jalter", "displayName": "Jon Alter", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "jalter", "key": "jalter", "displayName": "Jon Alter", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "TiSDK 1.6.2, iOS SDK 4.3, Emulator, Instruments", "comment": { "comments": [ { "id": "133432", "author": { "name": "nhuynh", "key": "nhuynh", "displayName": "Natalie Huynh", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Tested with 1.7.0.879871b...(05/10/11 19:34) on iPod 3rd Gen (4.0.1) ", "updateAuthor": { "name": "nhuynh", "key": "nhuynh", "displayName": "Natalie Huynh", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-05-11T14:32:21.000+0000", "updated": "2011-05-11T14:32:21.000+0000" } ], "maxResults": 1, "total": 1, "startAt": 0 } } }