{ "id": "123149", "key": "AC-2188", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "12217", "key": "AC", "name": "Appcelerator - INBOX", "projectCategory": { "id": "10000", "description": "", "name": "Customer Service" } }, "resolution": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2013-12-04T22:43:32.000+0000", "created": "2013-12-03T18:22:09.000+0000", "labels": [ "appendRow", "deleteRow", "insertRowBefore", "tableView", "tableViewRow" ], "versions": [], "issuelinks": [], "assignee": { "name": "srahim", "key": "srahim", "displayName": "Sabil Rahim", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2016-03-08T07:41:10.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": [], "description": "Step 1. Open iOS instruments and set the filter to tiui\r\nStep 2. Put the code below into app.js and run it\r\n{code}\r\nfunction crTable(){\r\n\tvar t=Ti.UI.createTableView({\r\n\t\t\teditable:true,\r\n\t\t\tclassName:'testing'\r\n\t\t});\r\n\t\t\r\n\t\tvar tdata=[];\r\n\t\tfor(var k=0;k<100;k++){\r\n\t\t\ttdata.push(Ti.UI.createTableViewRow({\r\n\t\t\t\ttitle:'hello'+k\r\n\t\t\t}));\r\n\t\t}\r\n\t\tt.setData(tdata);\r\n\t\treturn t;\r\n}\r\n\r\nfunction tableWindow(){\r\n\tvar win=Ti.UI.createWindow({\r\n\t\tbackgroundColor:'#fff'\r\n\t});\r\n\t\r\n\t\r\n\tvar table=crTable();\r\n\twin.add(table);\r\n\t\r\n\t\r\n\t//window close button\r\n\tvar closeButton=Ti.UI.createButton({\r\n\t\ttitle:'Close window',\r\n\t\ttop:10,\r\n\t\tzIndex:1\r\n\t});\r\n\t\r\n\tcloseButton.addEventListener('click',function(){\r\n\t\twin.close();\r\n\t\t\r\n\t});\r\n\twin.add(closeButton);\r\n\t\r\n\t\r\n\t//rows append button\r\n\t\r\n\tvar appendButton=Ti.UI.createButton({\r\n\t\t\ttitle:'Append table rows',\r\n\t\t\ttop:50,\r\n\t\t\tzIndex:1\r\n\t});\r\n\t\r\n\tappendButton.addEventListener('click',function(){\r\n\t\tvar rows=[];\r\n\t\tfor(var k=0;k<10;k++){\r\n\t\t\trows.push(Ti.UI.createTableViewRow({\r\n\t\t\t\ttitle:'row appended'+k\r\n\t\t\t}));\r\n\t\t}\r\n\t\ttable.appendRow(rows);\r\n\t});\r\n\t\r\n\twin.add(appendButton);\r\n\twin.open();\r\n}\r\n\r\n\r\nvar mainWin=Ti.UI.createWindow({\r\n\tbackgroundColor:'#fff'\r\n});\r\nvar openTableButton=Ti.UI.createButton({\r\n\ttitle:'Open new window with table'\r\n});\r\nopenTableButton.addEventListener('click',tableWindow);\r\nmainWin.add(openTableButton);\r\nmainWin.open();\r\n{code}\r\nStep 3. Click the button 'open new window with table'\r\nStep 4. Click the button 'Append new row' or alternatively , swipe a table row to the left and delete it \r\nStep 5. Click the button 'Close button'.\r\nStep 6. Repeat from steps 3 to 5 several times.\r\n\r\nDescription:\r\nThe methods of the table such as\r\n** table.appendRow(row)\r\n** table.deleteRow(row)\r\n** table.insertRowBefore(index,row), etc\r\nwhen used to alter an already existing table, produces severe case of memory leaks.\r\n\r\nThe behaviour of the leaks is described below very precisely -\r\n*1.* Open the window containing the table. The table has about 100 rows in it.\r\n*2.* Click the button 'Append table rows'.\r\n*3.* After appending, close the window and watch the changes in the instruments .\r\n*4.* Repeat these steps until you can see only *TiUITableViewRowProxy* and *TiUITableViewCell* retained alone in the instruments with 13kb+ memory allocated to the former and about 5kb+ memory allocated to the later. Do not click again the append button or delete any rows until you get to see the expected result in the instruments so as to give a better view of the nature of leaks.\r\n\r\n*5.* As soon as you obtained the expected result, start it over again from the first step for the second time but this time, by clicking the append row button too.\r\n*6.* Close the window and inspect the memory in the instruments.\r\n\r\n*7.* Now the *TiUiTableViewRowProxy* goes up to about 26kb+ and *TiUITableViewCell* to about 10kb+ \r\n\r\n*8.* As you keep on repeating these steps, each time the window is opened and close, the *TiUITableViewRowProxy* and *TiUITableViewCell* memory allocation gets incremented every time by about 13kb+ and 5kb+ respectively and never gets cleared at all.\r\n\r\n_However, if you simply open and close the window( i,e if you don't append or delete any rows), every TiUI proxy gets cleared on windows closed( this does not mean that the memory leak that was induced earlier by the append/delete methods gets cleared too but they remain stuck forever and increases as you opens and close the window after appending/deleting/altering the table) ._\r\n", "attachment": [], "flagged": false, "summary": "iOS: Severe memory leaks produced when appending/deleting/inserting rows to the table", "creator": { "name": "spaceman12", "key": "spaceman12", "displayName": "Lee phela", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "spaceman12", "key": "spaceman12", "displayName": "Lee phela", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Titanium SDK version 3.1.3.GA.222f4d1, iOS 7", "comment": { "comments": [ { "id": "282497", "author": { "name": "srahim", "key": "srahim", "displayName": "Sabil Rahim", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I tried the same code on simulator and the views do stay around even after you close the window containing the tableview. But once you do \"Simulate Memory Warning\" all the closed tableviewRows (and the associated ui elements) are being removed properly. On device, this is hard to verify as we can not ascertain when the garbage collector might kick in and hence it might seem like the views are still staying around but they are actually released and waiting around for the next GC cycle to completely remove it. \n\nmarking ticket as invalid.\n\nTested with cli 3.2.0-beta, SDK 3.2.0.v20131203104847\n", "updateAuthor": { "name": "srahim", "key": "srahim", "displayName": "Sabil Rahim", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-12-04T22:42:57.000+0000", "updated": "2013-12-04T22:42:57.000+0000" }, { "id": "282517", "author": { "name": "spaceman12", "key": "spaceman12", "displayName": "Lee phela", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Thank you for looking at it.\nAs per your testing environment, I just upgraded to SDK 3.2.0 and run my own test here but the leakage is still there. Like you said, I have even done the *Simulate memory warning* but to no effect and the *TiUITableViewRowProxy* and *TiUITableViewCell* still hangs on.\n\nIm *100%* sure that you've never click the *Append table rows* button to append rows to the existing table but just close down the window at the first sight on opening. I have made very clear from my post that under such a scenerio, no leakage is produced but only when the table is altered by means of appending/deleting/inserting, only then the leak is produced.\n\nPlease re-open this issue. Thank you", "updateAuthor": { "name": "spaceman12", "key": "spaceman12", "displayName": "Lee phela", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-12-04T23:46:20.000+0000", "updated": "2013-12-04T23:46:20.000+0000" }, { "id": "282532", "author": { "name": "srahim", "key": "srahim", "displayName": "Sabil Rahim", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~spaceman12]\nI did my original testing as per the instructions on the ticket. I did double check it on 6.1 and 7.1 simulator and found the same result.\nPlease [check the video|https://www.dropbox.com/s/dd7mn2oyoqks62i/ios7.1.mov] attached for what i was doing during testing \n\nVideo\nhttps://www.dropbox.com/s/dd7mn2oyoqks62i/ios7.1.mov\n\nPlease do let me know if i have missed any steps. Thanks\n", "updateAuthor": { "name": "srahim", "key": "srahim", "displayName": "Sabil Rahim", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-12-05T00:41:26.000+0000", "updated": "2013-12-05T00:41:26.000+0000" }, { "id": "282550", "author": { "name": "spaceman12", "key": "spaceman12", "displayName": "Lee phela", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Updated the *xcode* to the latest version and the leak is gone now. Thank you for your time.", "updateAuthor": { "name": "spaceman12", "key": "spaceman12", "displayName": "Lee phela", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-12-05T01:53:21.000+0000", "updated": "2013-12-05T01:53:36.000+0000" }, { "id": "286025", "author": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing as per updates fro Lee.", "updateAuthor": { "name": "shossain", "key": "shossain", "displayName": "Shak Hossain", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2013-12-27T23:57:07.000+0000", "updated": "2013-12-27T23:57:07.000+0000" } ], "maxResults": 5, "total": 5, "startAt": 0 } } }