iphone memory leaks and malloc?

Posted by Brodie4598 on Stack Overflow See other posts from Stack Overflow or by Brodie4598
Published on 2010-04-23T04:40:37Z Indexed on 2010/04/23 4:43 UTC
Read the original article Hit count: 346

Okay so im finally to the point where I am testing my iPad App on an actual iPad...

One thing that my app does is display a large (2mb) image in a scroll view. This is causing the iPad to get memory warnings. I run the app in the instruments to check for the leak.

When I load the image, a leak is detected and i see the following in the allocations:

ALl Allocations: 83.9 MB Malloc 48.55 MB: 48.55 MB Malloc 34.63 MB: 34.63 MB

What im trying to understand is how to plug the leak obviously, but also why a 2MB image is causing a malloc of 20x that size

I am very new to programming in obj-c so im sure this is an obvious thing, but I just cant figure it out. Here is the code:

© Stack Overflow or respective owner

Related posts about memory-leaks

Related posts about iphone