Re: Stale Objective-C object pointer detection
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