Re: Custom zones...
Re: Custom zones...
- Subject: Re: Custom zones...
- From: Alastair Houghton <email@hidden>
- Date: Tue, 10 Aug 2010 09:31:26 +0100
On 10 Aug 2010, at 05:18, charlie wrote:
> As you can see, the c string is successfully allocated from space in the custom zone. But the NSString object is allocated from the default zone, despite having called +[NSObject allocWithZone:].
>
> Anyone know the trick to this?
Sounds like a bug to me. While zones are *discouraged* (they're very definitely an advanced topic and easily misused), I don't think they're actually deprecated.
Anyway, the solution is to drop down a layer to Core Foundation. You can make an allocator that will use an NSZone easily enough using CFAllocatorCreate(), then pass that into CFStringCreate() as the allocator argument.
Kind regards,
Alastair.
--
http://alastairs-place.net
_______________________________________________
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