Re: Table View Blues (summary), or, allocWithZone not working
Re: Table View Blues (summary), or, allocWithZone not working
- Subject: Re: Table View Blues (summary), or, allocWithZone not working
- From: Timothy Ritchey <email@hidden>
- Date: Wed, 20 Nov 2002 15:01:04 -0500
>
But underneath - in the data management - something more streamlined
>
has to be engineered.
The good news: As per the release notes, Jag now properly supports
NSCreateZone, e.g.:
NSZone *z = NSCreateZone(10000, 10000, YES);
so that it returns a new zone instead of the default zone.
NSRecycleZone() still does not get rid of anything, so you have to use
some underlying methods to get rid of a zone in one large swipe. After
much trolling, I found:
NXDestroyZone() from <objc/zone.h> (you could also use
malloc_destroy_zone from <objc/malloc.h>)
These methods work on a malloc_zone_t, but you can cast an NSZone, and
things appear to work. I have not found the headers <objc/zone.h> or
<objc/malloc.h> documented ANYWHERE, except some old NeXTSTEP 3.3
developer manuals that I found online with Google. If someone has
pointers to current documentation on this I would appreciate a heads-up.
Now for the bad news: I can't seem to get any Foundation classes to
acknowledge allocWithZone:. I am not sure what good fixing NSCreateZone
to return unique zones actually was, if none of the Foundation classes
will actually USE the new zone. Anyone know if I am doing anything
wrong by just calling [[NSString allocWithZone:myZone] init...]? I
thought I recalled someone complaining about this before, but can't
seem to pull it up on google or mamasam.
However, if you are creating your own objects, and not using any
foundation classes, you can use the zones. Just use NSZoneMalloc([self
zone], size) in your init function for anything you want to dynamically
create.
Cheers,
tim
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.