Memory issue regarding UIImageView on IPhone 4.0 / IPad

Posted by Sagar Mane on Stack Overflow See other posts from Stack Overflow or by Sagar Mane
Published on 2010-08-23T15:11:37Z Indexed on 2010/12/25 0:54 UTC
Read the original article Hit count: 389

Filed under:
|

Hello All,

My Application is crashing due to low memory [ Received memory warning level 1 + 2]

To trace this I have used Instrument and come with following points

Test Enviorment : Single view controller added on Window

  1. When I don't use UIImageView Real Memory is used 3.66 MB

  2. When I uses UIImageView with Image having size 25 KB : Real Memory is used 4.24 MB. almost 560 KB extra when compare to w/o UIImageView and which keep on adding as I am adding more UIImageview on the view.

below is sample code for adding UIImageview which I am refering

UIImageView* iSplashImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Default-Landscape.png"]];
iSplashImage.frame = CGRectMake(0, 0, 320, 480);
[self.window addSubview:iSplashImage];

AND

dealloc

if(iSplashImage)
{
  [iSplashImage release];
  iSplashImage = nil;
}

Issue is this 560 KB is not getting release and after some time application receives low memory warning.

Can anyone point out if I am missing something or doing else. As My application uses lots of Images in One session.

Thanks in Advance,

Sagar

© Stack Overflow or respective owner

Related posts about ipad

Related posts about iphone-sdk-4.0