Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

beardedpig

macrumors member
Original poster
Dec 17, 2008
57
0
I have an array of images loaded using imagewithcontentsof file so no caching occurs.

Now lets say for arguments case the array has just 2 images (a lot more in reality) and these 2 images when loading into the array take up 2mb of memory.

Now I have an imageview which I set to switch between the images in the array using imageview.image = [myArray objectAtIndex: n];

When I do this memory usage increases as if I am loading another version of each image into memory so I end up with 4mb of memory usage.

In reality the numbers involved are greater and not so even but you get the idea.

I was under the impression that the image in the imageview was pointing to the array and not creating a new copy?

Have I lost the plot here?

Any help would be greatfully received

Thanks
 

caveman_uk

Guest
Feb 17, 2003
2,390
1
Hitchin, Herts, UK
I was under the impression that the image in the imageview was pointing to the array and not creating a new copy?
It is (or it should be) but that's not to say that setting a pointer is all that happens when you set the image property. There may be an internal representation of the image that's created for display. So maybe the memory usage will go up (especially if the previous value of .image was nil). I'd only worry if the memory usage keeps going up or you find you actually have a leak.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.