• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Question Regarding the Memory Address of Objects
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Question Regarding the Memory Address of Objects
      • From: Scott Ribe <email@hidden>
References: 
 >Question Regarding the Memory Address of Objects (From: "Carter R. Harrison" <email@hidden>)
 >Re: Question Regarding the Memory Address of Objects (From: David Duncan <email@hidden>)
 >Re: Question Regarding the Memory Address of Objects (From: "Carter R. Harrison" <email@hidden>)
 >Re: Question Regarding the Memory Address of Objects (From: "Dong Feng" <email@hidden>)
 >Re: Question Regarding the Memory Address of Objects (From: "Clark S. Cox III" <email@hidden>)

  • Prev by Date: Re: Using runtime functions to match up object types safely when setting properties
  • Next by Date: Re: Optimizing NSRectFill
  • Previous by thread: Re: Question Regarding the Memory Address of Objects
  • Next by thread: Re: Question Regarding the Memory Address of Objects
  • Index(es):
    • Date
    • Thread