Re: Question Regarding the Memory Address of Objects
Re: Question Regarding the Memory Address of Objects
- Subject: Re: Question Regarding the Memory Address of Objects
- From: "Michael Ash" <email@hidden>
- Date: Sat, 20 Dec 2008 12:11:19 -0500
On Sat, Dec 20, 2008 at 7:00 AM, Clark S. Cox III <email@hidden> wrote:
> The objective-c garbage collector does not move objects, so that is not an
> issue with using raw pointers.
But note that storing a pointer value in a string like this is still
problematic under garbage collection. It will not act like a strong
reference, so the object may be destroyed while still being
"referenced" by the string. But it will not act like a zeroing weak
reference either, so you'll still be able to get the pointer even
after it's been destroyed, which will (probably) lead to a crash.
An NSMapTable can be configured to give either reasonable behavior
(strong or zeroing weak reference) so use that instead.
Mike
_______________________________________________
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