[TIMOB-1489] Android: Setting Background Image can cause Out of Memory
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2011-04-17T01:56:18.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 1.5.0 M03 |
Components | Android |
Labels | android, defect |
Reporter | Don Thorp |
Assignee | Don Thorp |
Created | 2011-04-15T02:54:09.000+0000 |
Updated | 2011-04-17T01:56:18.000+0000 |
Description
Setting the background image can cause out of memory issues. If a couple of large images are set as background it's still possible to get OOM. VM budget exceeded.
Comments
- Friedrich Seydel 2011-04-15
This also occurs if large images are used within an imageview.
- Don Thorp 2011-04-15
Friedrich how large of an image and are you using the latest CI build?
- Friedrich Seydel 2011-04-15
Yes, latest CI build, really big images.
See this simple example.
app.js:
// an array of some random images var images = ['http://ddiff.com/wp-content/uploads/2009/11/Hurricane-Isabel-NASA.jpg','http://www.eurocarib.com/userimage/images/hurricane.gif']; var active_image = 0; // the image window var imagewin = Titanium.UI.createWindow({ fullscreen:true }); var imageView = Titanium.UI.createImageView({ canScale:true, enableZoomControls:true, top:0 }); imagewin.add(imageView); imagewin.addEventListener('close', function(e) { Ti.API.info('imagewin gets closed'); }); // the main window var win = Titanium.UI.createWindow({ fullscreen:true }); var button = Titanium.UI.createButton({ title: 'Show Next', bottom: 0 }); button.addEventListener('click', function(e) { active_image %= images.length; Ti.API.info('loading image #'+active_image); imageView.image = images[active_image++]; imagewin.open(); }); win.add(button); win.open();
Images load correctly about 4 times, then app crashes with OOM.
- Friedrich Seydel 2011-04-15
Correcting myself:
App doesn't crash but simply fails to display new image. - Don Thorp 2011-04-15
Verified resolved with basic camera, photo gallery, and code above. On emulator 2.2, N1 (2.2) and G2 (2.2) (version=1.5.0 timestamp=11/24/10 15:34 githash=735911a) no additional code changes.