Details

    • Type: Bug
    • Status: Closed
    • Priority: High
    • Resolution: Duplicate
    • Affects Version/s: Release 1.7.0, Release 1.8.1
    • Fix Version/s: None
    • Component/s: Android
    • Environment:

      Titanium SDK version: 1.7.0 (06/06/11 15:46 64155ee...)

      Description

      Problem

      Table view rows that you create are never released.

      Reproduction

      1. Drop the following in an app.js
      2. Load up DDMS and watch the Allocations or Sysinfo / Memory usage.
      3. Touch the "Create big table view" button in the app; a table view with 1500 rows will be created.
      4. Refresh the sysinfo and see how the memory footprint has grown.
      5. Hit the "Back" button in the app; the window is closed and the variables nullified.
      6. Refresh the sysinfo and see that the memory footprint hasn't changed.
      7. Repeat steps 3-7 and the memory footprint will only continue to grow.

      app.js

      var win = Ti.UI.createWindow({ backgroundColor:'#fff' });
       
      var btn = Ti.UI.createButton({
          color: 'black', layout:'center',
          title: 'Create big table view'
      });
      win.add(btn);
      win.open();
      btn.addEventListener('click', function() {
          var newWin = Ti.UI.createWindow({
              backgroundColor: '#fff',
              layout:'vertical'
          });
          var back = Ti.UI.createButton({
              color: 'black', top: 10,
              title: 'Back'
          });
          newWin.add(back);
       
          var tv = createBigTableView();
          newWin.add(tv);
          newWin.open();
       
          function clickListener() {
              back.removeEventListener('click', clickListener);
              newWin.close();
              tv.data = null;
              tv = null;
              newWin = null;
              back = null;
          }
       
          back.addEventListener('click', clickListener);
      });
       
      function createBigTableView() {
          var data = [];
          for (i = 1; i <= 1500; i++) {
              data.push(createCustomTableViewRow('RowsNMore', i));
          }
          return Ti.UI.createTableView({
              top:0, bottom:0, left:0, right:0,
              separatorColor: 'white',
              data: data
          });
      }
       
      function createCustomTableViewRow(label1text, label2text) {
          var row = Ti.UI.createTableViewRow({ className: 'customTVRow' });
          var vw = Ti.UI.createView({layout: 'vertical'});
          row.add(vw);
          vw.add(Ti.UI.createLabel({
              text: label1text, color: 'black',
              font: {fontSize: '9pt', fontWeight: 'bold'}
          }));
          vw.add(Ti.UI.createLabel({
              text: label2text, color: 'gray',
              font: {fontSize: '7pt', fontWeight: 'normal'}
          }));
          return row;
      }
      

      Associated Helpdesk Ticket

      http://appc.me/c/APP-321721

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                hpham Hieu Pham
                Reporter:
                dtoth Dawson Toth
              • Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-3738
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Integration