FROM : Bill Bumgarner
DATE : Sun Apr 13 23:48:45 2008
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
DATE : Sun Apr 13 23:48:45 2008
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
| Related mails | Author | Date |
|---|---|---|
| Alex Curylo | Apr 13, 22:35 | |
| Greg Titus | Apr 13, 23:15 | |
| Alex Curylo | Apr 13, 23:33 | |
| Bill Bumgarner | Apr 13, 23:48 | |
| Michael Ash | Apr 14, 00:35 |






Cocoa mail archive

