Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-1489] Android: Setting Background Image can cause Out of Memory

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2011-04-17T01:56:18.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.5.0 M03
ComponentsAndroid
Labelsandroid, defect
ReporterDon Thorp
AssigneeDon Thorp
Created2011-04-15T02:54:09.000+0000
Updated2011-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

  1. Friedrich Seydel 2011-04-15

    This also occurs if large images are used within an imageview.

  2. Don Thorp 2011-04-15

    Friedrich how large of an image and are you using the latest CI build?

  3. 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.

  4. Friedrich Seydel 2011-04-15

    Correcting myself:
    App doesn't crash but simply fails to display new image.

  5. 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.

JSON Source