[TIMOB-13852] Android: Application runs out of memory when user scroll the table quickly
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2013-06-20T22:29:54.000+0000 |
Affected Version/s | Release 3.0.2, Release 3.1.0 |
Fix Version/s | 2013 Sprint 13 API, 2013 Sprint 13 |
Components | Android |
Labels | ipass1, supportTeam |
Reporter | Rupesh Sharma |
Assignee | Ingo Muschenetz |
Created | 2013-05-14T07:15:42.000+0000 |
Updated | 2017-03-20T22:00:44.000+0000 |
Description
Description
In a quite big tableview with around 500 rows when Scrolling the table slowly, there is no problem at all. But on scrolling the table quickly, the app runs out of memory and it crashesTest Code
Titanium.UI.setBackgroundColor('#000');
var win1 = Titanium.UI.createWindow({
title:'Tab 1',
backgroundColor:'#fff'
});
var ref_data = new Array();
var rowView="";
var row="";
for (var a=0; a<= 500; a++){
row = Ti.UI.createTableViewRow();
row.selectedBackgroundColor = 'yellow';
row.backgroundColor = '#FFffff';
row.height = 55;
ref_data.push(row);
}
ref_tableView = Titanium.UI.createTableView({
data:ref_data,
height:'auto'
//backgroundColor:'white'
});
win1.add(ref_tableView);
win1.open();
Attachments
File | Date | Size |
---|---|---|
WP_20130531_001.mp4 | 2013-05-31T10:47:33.000+0000 | 6590666 |
Hi, Please see the attached video depicting the problem.
In the test case, when the table is scrolled, new rows are displayed on the screen so new label proxies are created. This means if the table is scrolled to the end, it needs to create 500 label proxies. That's why OOM happens. When the tableview has a large number of rows, the [className](http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.UI.TableViewRow-property-className) property is recommended to use. If we give the same className to the rows which have the same layout, our platform can reuse those proxies and only reset the content. This will save a lot of memory and make the tableview perform much better. Example code:
Closing as Invalid.
Closing ticket as invalid.