Releasing NSData causes exception...

Posted by badmanj on Stack Overflow See other posts from Stack Overflow or by badmanj
Published on 2009-04-16T12:20:35Z Indexed on 2010/04/03 21:23 UTC
Read the original article Hit count: 307

Filed under:
|
|
|
|

Hi,

Can someone please explain why the following code causes my app to bomb?

NSData *myImage = UIImagePNGRepresentation(imageView.image);
  :
[myImage release];

If I comment out the 'release' line, the app runs... but a few times calling the function containing this code and I get a crash - I guess caused by a memory leak.

Even if I comment EVERYTHING else in the function out and just leave those two lines, when the release executes, the app crashes.

I'm sure this must be a newbie "you don't know how to clean up your mess properly" kind of thing ;-)

Cheers,

Jamie.

© Stack Overflow or respective owner

Related posts about iphone

Related posts about memory