Toll Free Garbage
Toll Free Garbage
- Subject: Toll Free Garbage
- From: "Gerriet M. Denkmann" <email@hidden>
- Date: Mon, 22 Dec 2008 14:40:24 +0700
Assume some plug-in, which must work with garbage collection on or off.
Assume further, that there is a method (not under our control):
- (NSString *)copySomething;
And that this method returns either an NSString* or a toll free
bridged CFStringRef, of which we are the owner (because the name
contains "copy").
If we do:
NSString *s = [ someObject copySomething];
// do something with "s"
[s release];
it will work without garbage collection, but leak otherwise in the
case of a CFStringRef.
How to get rid of "s" ?
Simply calling CFRelease() is no good, because it might be an
NSString* on which someone has done a CFRetain().
Kind regards,
Gerriet.
_______________________________________________
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