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 (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