Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

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

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2011-12-15T17:47:42.000+0000
Affected Version/sRelease 1.8.0.1
Fix Version/sSprint 2011-50, Release 1.8.0.1, Release 2.0.0
ComponentsAndroid
Labelsmodule_imageview, qe-testadded, verified-1.8.0.1
ReporterBill Dawson
AssigneeBill Dawson
Created2011-12-15T10:05:19.000+0000
Updated2017-06-21T22:00:06.000+0000

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.
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();

Comments

  1. Wilson Luu 2011-12-19

    Verified fix on: SDK build: 1.8.0.1.RC3 Runtime: V8, Rhino Titanium Studio, build: 1.0.7.201112152014 OS: Mac OS X Lion Device: Nexus One (2.2.2) Note: Did not verify fix on sdk build 1.9.0
  2. Wilson Luu 2012-01-11

    Closing bug. Already verified fix on 1.8.0.1

JSON Source