• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: autorelease: how does this work!? (if at all)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: autorelease: how does this work!? (if at all)


  • Subject: Re: autorelease: how does this work!? (if at all)
  • From: Laurent Daudelin <email@hidden>
  • Date: Fri, 18 Jun 2010 15:34:42 -0400

On Jun 18, 2010, at 15:15, Jonny Taylor wrote:

>> [theImage release] is really suspicious.
> Suspicious in what way? Are you saying I am using the wrong sort of implementation for my [frame GetNSImage], and I shouldn't be returning something that requires an explicit release? Because I can certainly confirm that in its current state it leaks memory unless I include the release - the function is returning an internally cached NSImage with its reference count incremented by one.
>
> To be fair the release is in an illogical place - it should immediately follow the call to [theImage TIFFRepresentation], but with the code as currently written, the release is definitely necessary..._______________________________________________

Usually, you don't release objects you don't own. In the block you showed, there really is no indication that you own theImage (there is no alloc/init, copy or retain) so you shouldn't release it, unless I'm missing something with blocks.

-Laurent.
--
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin 				http://www.nemesys-soft.com/
Logiciels Nemesys Software              				email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >autorelease: how does this work!? (if at all) (From: Jonny Taylor <email@hidden>)
 >Re: autorelease: how does this work!? (if at all) (From: Mike Abdullah <email@hidden>)
 >Re: autorelease: how does this work!? (if at all) (From: Jens Alfke <email@hidden>)
 >Re: autorelease: how does this work!? (if at all) (From: Julien Jalon <email@hidden>)
 >Re: autorelease: how does this work!? (if at all) (From: Jonny Taylor <email@hidden>)

  • Prev by Date: Re: autorelease: how does this work!? (if at all)
  • Next by Date: Re: autorelease: how does this work!? (if at all)
  • Previous by thread: Re: autorelease: how does this work!? (if at all)
  • Next by thread: Re: autorelease: how does this work!? (if at all)
  • Index(es):
    • Date
    • Thread