NSAllocateCollectable() questions
NSAllocateCollectable() questions
- Subject: NSAllocateCollectable() questions
- From: Brendan Younger <email@hidden>
- Date: Tue, 15 Apr 2008 00:42:07 -0500
Hi all,
This is a re-post since I didn't receive any response on Sunday.
I've been writing a library that uses NSAllocateCollectable() quite a
bit and I have a few questions about proper usage.
- Copying data
if I am copying to a malloc'd block, I can use memmove() regardless of
whether the source is GC'd or not, right?
if I am copying to a GC block allocated with NSScannedOption, I need
to use objc_memmove_collectable(), right?
if I am copying to a GC block allocated with nonscanned memory, I can
use memmove(), right?
- Zero'ing data
There does not seem to be a GC-compatible bzero(). If I loop through
and zero out each pointer in a scanned block, that would generate a
write barrier for each pointer which is expensive. However, if I use
bzero(), then libauto won't know that I've messed with the block.
Will it eventually figure it out when it does an exhaustive scan? Or
will it never notice that I've zero'd out the block?
Thanks,
Brendan
_______________________________________________
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