Quantcast
Viewing all articles
Browse latest Browse all 8068

ImageViews Leaking in Memory

Hey guys,

I'm running into a high problem which is preventing me from publishing my app to the app store.

Any time I load an image, that image (ImageIO_jpeg_data) gets stored in memory and never released.

var win = Ti.UI.createWindow({
    backgroundColor : 'red'
});
 
var imageview = Ti.UI.createImageView();
win.add(imageview);
 
var button = Ti.UI.createButton({
    top : 70,
    left : 10,
    width : 300,
    height : 50,
    title : "Set Label's Text"
});
 
win.add(button);
 
var first = false;
 
var updateLabelText = function() {
    if (first == false) {
        imageview.image = 'http://phaseoneimageprofessor.files.wordpress.com/2013/07/iqpw29_main_image_.jpg';
        first = true;
    } else {
        imageview.image = null;
        win.remove(imageview);
        imageview = null;
        button.removeEventListener('click', updateLabelText);
    }
};
 
button.addEventListener('click', updateLabelText);
win.open();
Using Instruments, I found out that any image I load is using so much memory and never using released (my app has hundreds of images, so you could imagine how that's working for me).

http://s1.postimg.org/5dpnlzy27/Screen_Shot_2014_03_11_at_4_57_38_PM.png

I'm using the latest daily build, latest xCode, latest iOS etc.

Would really appreciate the help.

Thanks guys, Abdul


Viewing all articles
Browse latest Browse all 8068

Trending Articles