Obsolete autorelease debugging documentation in NSDebug.h
| Originator: | jhawk | ||
| Number: | rdar://10646768 | Date Originated: | 04-Jan-2012 11:16 PM (Eastern) |
| Status: | Open | Resolved: | |
| Product: | Mac OSX | Product Version: | 10.7.2/11C74 |
| Classification: | Other | Reproducible: | Always |
Summary:
Doc bug.
NSDebug.h (/System/Library/Frameworks/Foundation.framework/Headers/NSDebug.h) documents environment variables and functions suitable for debugging autorelease pool leaks. The documentation appears to not have been updated since 10.6, and the functions and variables that worked in 10.6 do not appear to do anything in 10.7.
Please update the NSDebug.h comments and text to reflect reality.
For instance, line 105 and following:
/**************** Autorelease pool debugging ****************/
// Functions used as interesting breakpoints in a debugger
// void __NSAutoreleaseNoPool(void *object);
// Called to log the "Object X of class Y autoreleased with no
// pool in place - just leaking" message. If an environment
// variable named "NSAutoreleaseHaltOnNoPool" is set with string
// value "YES", the function will automatically break in the
// debugger (or terminate the process).
// void __NSAutoreleaseFreedObject(void *freedObject);
// Called when a previously freed object would be released
// by an autorelease pool. If an environment variable named
// "NSAutoreleaseHaltOnFreedObject" is set with string value
// "YES", the function will automatically break in the debugger
// (or terminate the process).
However __NSAutoreleaseNoPool() does not appear to be called, and no change happens when NSAutoreleaseHaltOnNoPool is set to YES in the environment.
Steps to Reproduce:
1. Find an app that prints autorelease pool errors, such as:
objc[71689]: Object 0x4922bb0 of class __NSCFString autoreleased with no pool in place - just leaking - break on objc_autoreleaseNoPool() to debug
2. Try to debug using standard techniques learned from 10.6, i.e. setting NSAutoreleaseHaltOnNoPool to YES or breaking on __NSAutoreleaseNoPool() in gdb.
Expected Results:
The breakpoint should trip or the app should exit.
Actual Results:
Nothing happens.
Regression:
Notes:
If one reads the printf carefully, it suggests breaking on objc_autoreleaseNoPool(). This indeed works, and is a straightforward workaround. But please update NSDebug.h so this is more clear.
Additionally, there have historically been more fine-grained tools than simply a function to set a breakpoint on. If those still exist, any documentation about them would be very much appreciated.
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!