iphoneiosuiimageviewvideo-memory

UIImageView & video memory


I have interesting problem with my UiimageViews. I have an application (game with 2 houses) where I loaded a lot of images on the screen (I'm using UIIMageView). Works fine on ios4.3 but have a lot crashes on ios5 (I've look at free memory on spc programs difference is around 40-50mb!).

I've removed all @2x images (for retina devices) where it was possible and now i have somewhat less crashes - but they still present.

I've analyzed and found that all crashes appear between viewWillAppear and viewDidAppear. Looks like when images loading into video memory.

I have 2 houses in game and I can loading any house first, then I unload house (of course instruments shows that I have no leaks). I try to load second house and then I have crash. Looks like Images not unloading from videomemory. Is it possible ?

When we remove @2x images then we can load more houses but then crash again sometimes between viewWillAppear and viewDidAppear.

Thanks,


Solution

  • Looks like a typical case of your app being terminated because it takes up too much memory. You can check this by implementing the didReceiveMemoryWarning callback. How big are your images? There are a number of posts on memory issues with UIImageViews, for example here. You must make sure that the UImageViews are removed from their superviews and properly released when not needed.