Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reduce Memory Usage in iOS App without leaks

Tags:

My iOS app has high memory usage but no memory leaks. How do I reduce the memory usage.

Using Instruments, I discovered that my app maxes out at 90MB, before a memory warning occurs, and other memory is deallocated, and then it stays around 55-65MB for the rest of its usage.

I feel that 55-65MB is too high, right?

Since, Instruments did not catch any leaks. What can I do to reduce this memory usage?

I went through this year's WWDC video, but of the stuff I understood (this is my first iOS app), it mostly covered dealing with leaks.

Some possibly useful information:

VM: ImageIO_GIF_Data 30.35MB Live Bytes | 115 Living | 300 Transient | 136.12 MB Overall Bytes

VM: MappedFile 36.04 MB Live Bytes | 16 Living | 11 Transient | 36.09 MB Overall Bytes

All the other stuff is under 1MB

My app downloads around 30 GIF files from the internet, I use SDWebImage, and I just save the URLs of the images, and SDWebImage does the rest. :P

Thanks in advance,

From An iOS Memory Management First Timer


Here is a screenshot of what Instruments shows me

Thanks once again for you help

like image 998
GangstaGraham Avatar asked Jul 14 '13 20:07

GangstaGraham


1 Answers

You say you are using a table view. Although cells are reused automatically, this makes it very easy to make mistakes and create too many objects. 1 common error is allocating objects (eg. UIImageView) in the cellForRowAtIndexPath method, as this means every time a cell is reused a new UIImageView is added to it as well as keeping the old ones. So double check what is going on in your cellForRowAtIndexPath method.

like image 178
Darren Avatar answered Oct 14 '22 07:10

Darren