Re: Custom zones...
Re: Custom zones...
- Subject: Re: Custom zones...
- From: Quincey Morris <email@hidden>
- Date: Mon, 9 Aug 2010 23:52:23 -0700
On Aug 9, 2010, at 21:18, charlie wrote:
> NSString * string = [[NSString allocWithZone:zone] initWithFormat:@"abc!!!"];
> 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:].
Well, the first result from googling "nsstring allocwithzone" is this:
http://www.cocoabuilder.com/archive/cocoa/52643-allocwithzone-not-working-with-class-clusters.html
which is pretty old but is still a valid reason why the specified zone might not be honored.
A second possibility is that the initializer you chose to use makes a decision where to put the NSString object based on where the format string is.
Whatever the reason, you don't have absolute control over the zone an object is allocated in, and I believe that specifying a zone at all is currently regarded as undesirable, if not yet actually deprecated.
_______________________________________________
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