Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-6692

Android: ImageView with just one dimension size specified and placed on a TableViewRow can easily lead to Out Of Memory exceptions

    Details

      Description

      Fail Case / Test Case

      1. Create a new app.

      2. Replace the contents of the app's app.js with the code below.

      3. Run the app.

      Symptom

      Even though the app only contains a 30-row table view with a small (46x43) image on each row, it can easily run out of memory. You might even see (depending on memory on your device) that not every row gets the image to begin with, because memory already ran out while rendering the table. Otherwise, scroll up and down in the table view, and check logcat – eventually you'll start seeing long exception traces for an out of memory condition.

      app.js

      Titanium.UI.setBackgroundColor('#000');
      var win = Titanium.UI.createWindow({  
          title:'Test',
          backgroundColor:'#000',
      	exitOnClose: true
      });
       
      var rows = [];
      for (var i = 0; i < 30; i++) {
      	var row = Ti.UI.createTableViewRow({height: "40dp"});
      	var iv = Ti.UI.createImageView({image: "KS_nav_ui.png", height: "43"});
      	row.add(iv);
      	rows.push(row);
      }
       
      var tv = Ti.UI.createTableView({data: rows});
      win.add(tv);
      win.open();
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                billdawson Bill Dawson
                Reporter:
                billdawson Bill Dawson
              • Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

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

                    Git Integration