Question

I am able to load over 200 UIImage objects into a NSMutableDictionary without any memorry warning issues.

When I start displaying them on the screen (after about showing 10-20 images) I get low memory warnings and an eventual crash.

Only about 8 images are displayed at anyone time.

Does it take additional memory to actually draw a UIImage on the screen?

No memory leaks are showing up and i've reviewed code for leaks many many times.

Was it helpful?

Solution

The documentation says that having a UIImage doesn't necessarily imply that the image is actually stored in memory, because it could be purged from the image cache. But it does say that if you try to draw it, it will be pulled back into memory. Maybe it starts purging from its image cache before it warns you about the low memory condition. That explains everything you're seeing.

OTHER TIPS

Its probable that you initially create a link to the image, the only data that is actually read at this time are dimensions and image type (in short), the rest of the data is usually not needed until requested usually from a background process i.e. displayed on screen. When it is displayed the actual image data is downloaded from the filepath and decoded according to its image type, it is then cached so it doesn't have to be downloaded again, the caching takes a lot of memory plus if your using double/triple buffering there's extra memory required for the off screen drawing. Try disposing of all image data before loading new images.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top