On Fri, Apr 24, 2009 at 6:42 AM, Todd Heberlein <todd_heberl...@mac.com> wrote:
> For example, will
>
> foo2( CFSTR("bar") ); or
> foo2 ( CFStringCreateWithCString(NULL, "bar", kCFStringEncodingASCII) );
>
> leak memory?

The first won't, but the second will. It's similar to taking the
[[NSString alloc] initWithCString:] route. All Core Foundation creator
functions with Create or Copy in the name leave you with the
responsibility of releasing the return value when you're done with it.

There's a relatively new CFMakeCollectable() function which marks a
Core Foundation type as collectable by the garbage collector, but I
have no experience with it.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to