Hello I’m working on an iPhone application which provides information with images and texts. In every text there is one image, which can be clicked and zoomed, shown with a UIImageView
NSString* imgName = [imgPath substringToIndex:[imgPath rangeOfString:@".jpg"].location];
UIImage* img = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:imgName ofType:@"jpg"]];
[imgView setImage:img];
as I go through the images by opening them one by one the app crashes(debug on device). with some error in console:
: Decompression error
my_app_name(1226,0x3e088868) malloc: * mmap(size=32768) failed (error code=12)
* error: can’t allocate region
and then:
CoreAnimation: failed to allocate 2228352 bytes.
I don’t have leak in code and if I do not open the images I don’t get the error. so does anyone have a clue where this problem could be?
Seems you are using too much memory?
How many images do you open? Start with instruments attached and watch the memory footprint.
Keep in mind that images take much more memory when loaded than compressed on disk.