Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Critical Critical
    • Resolution: Cannot Reproduce
    • Affects Version/s: None
    • Fix Version/s: Sprint 2011-32
    • Component/s: iOS
    • Labels:
    • Environment:
      • IOS 4.2, IOS 4.3
      • Titanium 1.7.0, 1.7.1
      • mac os 1.6.7

      Description

      If you use setdata on IOS the tableviewrow dont release. If I compile with 1.7.0 Release Candidate there is no problems. This only appears if I try to compile to 1.7.0 final or 1.7.1. Using Intruments its clear the behavior difference between 1.7 RC and 1.7.1 and 1.7.0

      Test case bellow:

      var win = Titanium.UI.createWindow(
      {
          title: 'Tableview Test'
      });
      var runNumber = 0;
      var tableview = Titanium.UI.createTableView({
      	backgroundColor: 'white',
      	border: 1,
      	borderColor: '#E0E0E0',
      	width: 315,
      	height: 450,
      	left: 35,
      	top: 75,
      	allowsSelection: true,
      	separatorStyle: Ti.UI.iPhone.TableViewSeparatorStyle.SINGLE_LINE
      	});
      	
      win.add(tableview);
      
      var buttomSetData = Titanium.UI.createButton({
      	title: 'Set data',
      	bottom: 50,
      	right: 480,
      	border: 1,
      	height: 100,
      	width: 47
      });
      
      buttomSetData.addEventListener('click', function (e) {
      var tableviewData =[];
      	
      for(var i=0;i<200;i++)
      {	
      	var row1 = Ti.UI.createTableViewRow();
      	var infoLabel = Titanium.UI.createView({
      				height: 12,
      				width: 12,
      				//backgroundImage :'images/delrow.png',
      				backgroundColor: 'red',
      				top: 8,
      				left: 20
      			});
      			
      	var textLabel = Ti.UI.createLabel({
      			color: '#000',
      			text: 'Run number ' + runNumber  + ' Row number '  + i,
      			font: {
      				fontSize: 15
      			},
      			top: 5,
      			left: 50,
      			height: 20,
      			width: 260
      		});		
      			row1.add(textLabel);
      			row1.add(infoLabel);
      		tableviewData.push(row1);	
      			
      }			
      tableview.setData(tableviewData);
      
      runNumber++	
      });
      win.add(buttomSetData);
      win.open();
      

        Activity

        Hide
        Paul Dowsett added a comment -

        Thanks for raising this ticket. Please remember to state the build date and hash of the Titanium SDK you have tested. You will find this information in the log on application launch. Please read the Jira Ticket Checklist for future tickets.

        Cheers

        Show
        Paul Dowsett added a comment - Thanks for raising this ticket. Please remember to state the build date and hash of the Titanium SDK you have tested. You will find this information in the log on application launch. Please read the Jira Ticket Checklist for future tickets. Cheers
        Hide
        Sabil Rahim added a comment -

        Checked Against 1.7.2 release and 1.8 master cannot reproduce.

        Show
        Sabil Rahim added a comment - Checked Against 1.7.2 release and 1.8 master cannot reproduce.
        Hide
        Sabil Rahim added a comment -

        Tested against 1.7.2 release and 1.8 master

        Show
        Sabil Rahim added a comment - Tested against 1.7.2 release and 1.8 master
        Hide
        Tim Poulsen added a comment -

        I can reproduce this problem with both 1.7.2 final and 1.8.0.v20110915133349. Watching via instruments shows row proxies are not being released or reused; memory grows continuously as you "reset" the table.

        function setRows(_start) {
        	var rows = [];
        	var end = _start + 100;	
        	for(var i = _start; i < end; i++) {
        		var row		= Ti.UI.createTableViewRow({
        			title:'Test '+i
        		});
        		rows.push(row);
        	}
        	return rows;
        }
        var table = Ti.UI.createTableView({ 
        	data: setRows([]) ,
        	bottom: 70
        });
        var button	= Ti.UI.createButton({ 
        	title: "Reset Data",
        	height: 50,
        	width: 200,
        	bottom: 10 
        	
        });
        var click = 0;
        button.addEventListener("click", function() {
        	click += 100;
        	table.setData(setRows(click));
        // The following doesn't release memory/row proxies either
        //	table.data = setRows(click);
        // nor does
        //	table.data = [];
        //	table.setData(setRows(click));
        });
        win1.add(table);
        win1.add(button);
        

        See also http://jira.appcelerator.org/browse/TIMOB-3799 and http://developer.appcelerator.com/question/120923/tableview-setdata-doesnt-clear-memory

        Show
        Tim Poulsen added a comment - I can reproduce this problem with both 1.7.2 final and 1.8.0.v20110915133349. Watching via instruments shows row proxies are not being released or reused; memory grows continuously as you "reset" the table. function setRows(_start) { var rows = []; var end = _start + 100; for(var i = _start; i < end; i++) { var row = Ti.UI.createTableViewRow({ title:'Test '+i }); rows.push(row); } return rows; } var table = Ti.UI.createTableView({ data: setRows([]) , bottom: 70 }); var button = Ti.UI.createButton({ title: "Reset Data", height: 50, width: 200, bottom: 10 }); var click = 0; button.addEventListener("click", function() { click += 100; table.setData(setRows(click)); // The following doesn't release memory/row proxies either // table.data = setRows(click); // nor does // table.data = []; // table.setData(setRows(click)); }); win1.add(table); win1.add(button); See also http://jira.appcelerator.org/browse/TIMOB-3799 and http://developer.appcelerator.com/question/120923/tableview-setdata-doesnt-clear-memory
        Hide
        Daniel de Andre added a comment -

        To be honest, I have no idea how you 'cannot reproduce'... Just open instruments and you will see it.

        I will stay with 1.7.0 RC until this is fixed.

        Show
        Daniel de Andre added a comment - To be honest, I have no idea how you 'cannot reproduce'... Just open instruments and you will see it. I will stay with 1.7.0 RC until this is fixed.
        Hide
        Tim Poulsen added a comment -

        I have tested with both the customer's code and the code I supplied using 1.8.1 and I cannot reproduce the leak. The object count grows till it hits a threshold and then objects are garbage collected as expected.

        I tried attaching a screen to the ticket, but it didn't seem to work. Here's a screen shot of Instruments showing my testing session using the customer's code. https://skitch.com/skypanther/g7quq/screen-shot-2012-01-31-at-3.34.47-pm You can see memory use grow, then objects are GC'd, and memory then drops.

        Show
        Tim Poulsen added a comment - I have tested with both the customer's code and the code I supplied using 1.8.1 and I cannot reproduce the leak. The object count grows till it hits a threshold and then objects are garbage collected as expected. I tried attaching a screen to the ticket, but it didn't seem to work. Here's a screen shot of Instruments showing my testing session using the customer's code. https://skitch.com/skypanther/g7quq/screen-shot-2012-01-31-at-3.34.47-pm You can see memory use grow, then objects are GC'd, and memory then drops.

          People

          • Assignee:
            Sabil Rahim
            Reporter:
            Daniel de Andre
          • Watchers:
            9 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: