• 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
Toll Free Garbage
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Toll Free Garbage
      • From: "Julien Jalon" <email@hidden>
  • Prev by Date: Re: Xcode Question
  • Next by Date: Re: os x gui scripting
  • Previous by thread: Re: Xcode Question
  • Next by thread: Re: Toll Free Garbage
  • Index(es):
    • Date
    • Thread