1

Hello everyone i am using AFNetworking to download images in a scroll view. Let's say about 20 images to be downloaded.

[image setImageWithURL:[NSURL URLWithString: [@"example.com"]];

Everything works fines until if there are 100 images each 300 k in size then it causes memory warning and the app is suspended and closed.

  1. My question is it causing a memory leak somewhere?
  2. Should i use a tableview instead of the scrollview?

thanks :)

veereev
  • 2,650
  • 4
  • 27
  • 40
  • 1
    1. You tell us; use `Instruments` to find out. 2. Yes I would think that's a good idea. – trojanfoe Mar 06 '13 at 07:35
  • Hello thanks for you reply but i used a tableview i am showing 10 rows. each row has 2 images to be streamed. ( each image weighs 700k) i.e its downloading 1.4 M for 1 row and when i try to scroll the app closes. i have check instruments no memory leaks so far and the app growsa to 25.2 M and it closes by itself. i noticed this app closing issue when using large images. – veereev Mar 06 '13 at 08:40
  • I wonder if there is any benefit to resizing the images to be the same size as the imageview? This would save some memory for sure. – trojanfoe Mar 06 '13 at 08:47
  • Ok good point .. i read this just now. the image size in px is 1936 * 2500 px and the imageview is in px is 60 * 60 px. is this causing the issue? What should i do : should i downsize the image when i have downloaded it ? – veereev Mar 06 '13 at 08:50
  • Well resizing the images is simple to do and will save a great deal of memory. Google "ios resize image". – trojanfoe Mar 06 '13 at 08:53
  • http://stackoverflow.com/questions/612131/whats-the-easiest-way-to-resize-optimize-an-image-size-with-the-iphone-sdk – trojanfoe Mar 06 '13 at 08:55

0 Answers0