autorelease: how does this work!? (if at all)
autorelease: how does this work!? (if at all)
- Subject: autorelease: how does this work!? (if at all)
- From: Julien Jalon <email@hidden>
- Date: Sat, 19 Jun 2010 03:47:18 +0200
Suspicious because it clearly does not follow ObjC coding style for
memory management.
If you have to call release here, it's likely because GetNSImage is
incorrect by returning an object that needs to be released.
If your code happens not to use C++ (or in very localized places), you
should run Build & Analyze (in Build menu) and see the static analyzer
pointing to where your code might clearly be wrong wrt coding style
and memory management.
--
Julien
On Friday, June 18, 2010, Jonny Taylor <email@hidden> 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...
_______________________________________________
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