• 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
CF autorelease?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CF autorelease?


  • Subject: CF autorelease?
  • From: Todd Heberlein <email@hidden>
  • Date: Thu, 23 Apr 2009 13:42:13 -0700

Many of the Cocoa object allocation methods automatically do an autorelease before returning the pointer to the object, so I can call something like:

foo( [NSString stringWithCString: "bar" encoding: NSASCIIStringEncoding] );

and then not worry about memory leakage. Is the same true with Core Foundation calls? For example, will

foo2( CFSTR("bar") ); or
foo2 ( CFStringCreateWithCString(NULL, "bar", kCFStringEncodingASCII) );

leak memory?

I am wondering if I need to do stuff like:

CFStringRef tmp_str = CFSTR("bar");
foo2(tmp_str);
CFRelease(tmp_str);

Thanks,

Todd

_______________________________________________

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: CF autorelease?
      • From: Charles Srstka <email@hidden>
    • Re: CF autorelease?
      • From: Michael Ash <email@hidden>
    • Re: CF autorelease?
      • From: Dave Geering <email@hidden>
    • Re: CF autorelease?
      • From: Clark Cox <email@hidden>
  • Prev by Date: Re: Bindings making NSNumberFormatter strange
  • Next by Date: Re: CF autorelease?
  • Previous by thread: Re: Best practice regarding display of many similar items in a lengthy view
  • Next by thread: Re: CF autorelease?
  • Index(es):
    • Date
    • Thread