Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

memory management and images

I seem to be missing something when resizing images...

My app has a table view using custom cells with multiple labels and images. The custom cell initWithFrame allocs the labels and UIImageViews, adds them as subviews and then releases. The custom cell layout function sets the frame for each of the UIImageViews, not big as there are four images covering only half the width of the cell. My cellForRowAtIndexPath checks for any existing image (within each image view), releases it if it is there and assigns the appropriate new one into the image view. My actual image files are large, as they are designed for full screen display on another view, so effectively I'm mimicking a thumbnail type display. I thought the fact that I'd restricted the frame on each UIImageView would ensure that only a small amount of memory would be used for each one. Yet when the app first shows the table view, 6 rows with a total of 11 images, I get a memory warning from the iPad.

Example photo album style apps I've seen seem to do something similar, they don't use a separate file with a small version of the image. Any suggestions on what I am doing wrong which is gobbling up memory?

Any assistance much appreciated!

Posted on Aug 17, 2012 2:17 AM

Reply
Question marked as Best reply

Posted on Aug 17, 2012 3:10 AM

The memory consumed by a file is not based on the display size of the file. It is not even based on the size of the file on disk. It is based on the physical dimensions of the file. Even a small JPEG file can turn out to be massive in memory. Find out how big your images should be on the screen with a retina display and create smaller versions of them for your thumbnails. That is your only option.

4 replies
Question marked as Best reply

Aug 17, 2012 3:10 AM in response to MarionMck

The memory consumed by a file is not based on the display size of the file. It is not even based on the size of the file on disk. It is based on the physical dimensions of the file. Even a small JPEG file can turn out to be massive in memory. Find out how big your images should be on the screen with a retina display and create smaller versions of them for your thumbnails. That is your only option.

Aug 17, 2012 3:29 AM in response to etresoft

Thanks etresoft, but I still think I'm missing something fundamental. I can take hundreds of photographs on my iPad, each about 1MB. They will be happily displayed as thumbnail-type images in the Photos app, 5 to a row. I don't see a second small image file if I browse the iPad. My image files are around 0.5MB, so surely that means I should be able to do something similar.

memory management and images

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.