• 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: Stale Objective-C object pointer detection
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Stale Objective-C object pointer detection


  • Subject: Re: Stale Objective-C object pointer detection
  • From: Bill Bumgarner <email@hidden>
  • Date: Sun, 13 Apr 2008 16:48:45 -0500

On Apr 13, 2008, at 3:35 PM, Alex Curylo wrote:
OK, then, what would an equivalently useful value to set a released Objective-C object pointer/ivar to in order to cause any subsequent access of it to stop the program immediately? 0xDEADBEEF perhaps?

Well.. you could do what Greg said and go all NSZombie on it, but you have to remember to do that and stuff.


If you want a total hack, just assign (id) 0x1 to any variable that really ought to never be used again or better be initialized before being used again.

If you want to get terribly fancy, you could create your own root class that implements (on Leopard) -resolveInstanceMethod: / +resolveClassMethod: and logs, then crashes.

I wrote up some messaging hints here:

http://www.friday.com/bbum/2008/01/01/objective-c-a-hack-to-log-all-methods/
http://www.friday.com/bbum/2008/01/02/objective-c-logging-messages-to-nil/

b.bum
_______________________________________________

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


References: 
 >Re: Cocoa-dev Digest, Vol 5, Issue 600 (From: Alex Curylo <email@hidden>)
 >Re: Cocoa-dev Digest, Vol 5, Issue 600 (From: Greg Titus <email@hidden>)
 >Stale Objective-C object pointer detection (From: Alex Curylo <email@hidden>)

  • Prev by Date: Re: Stale Objective-C object pointer detection
  • Next by Date: Re: NSArray to NSString
  • Previous by thread: Re: Stale Objective-C object pointer detection
  • Next by thread: IKImageBrowserView Title & Subtitle Woes
  • Index(es):
    • Date
    • Thread