Implement CRASH_ON_ZOMBIE for memory debugging

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@23267 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2006-08-13 07:09:31 +00:00
parent 6e330ec7aa
commit 1920a76e9e
3 changed files with 27 additions and 1 deletions

View file

@ -3,6 +3,8 @@
* Source/GSFormat.m: optimise a bit and fix bug where utf8 (and other
multibyte encodings) strings could be truncated at the wrong
precision.
* Source/NSObject.m: implement CRASH_ON_ZOMBIE
* Documentation/Base.gsdoc: document it.
2006-08-12 Richard Frith-Macdonald <rfm@gnu.org>

View file

@ -261,6 +261,24 @@ notice and this notice are preserved.
variable will cause the program to generate a core dump.
</p>
</desc>
<term>CRASH_ON_ZOMBIE</term>
<desc>
<p>
When the a message is sent to a zombie object (see the
<code>NSZombieEnabled</code> environment variable) the
base library allows you to specify whether the program
should continue after logging the message, or have the
program abort.<br />
By default, the program will attempt to continue.
</p>
<p>
The <code>CRASH_ON_ZOMBIE</code> variable can be used to
override this behavior. If this is defined to <em>YES</em>,
<em>TRUE</em>, or <em>1</em> then the program will log the
message sent to the zombie and then abort, producing a
core dump on systems where that is possible.
</p>
</desc>
<term>GNUSTEP_STRING_ENCODING</term>
<desc>
<p>
@ -405,7 +423,9 @@ notice and this notice are preserved.
You can set a breakpoint in this function and examine the
process memory if you are running under a debugger.<br />
As this overrides actual object deallocation, all memory
allocated for objects will be leaked!
allocated for objects will be leaked!<br />
You can use the <code>CRASH_ON_ZOMBIE</code> environment
variable to force an abort afdter the message is logged.
</p>
</desc>
<term>SOCKS5_SERVER</term>

View file

@ -147,6 +147,10 @@ static void GSLogZombie(id o, SEL sel)
NSLog(@"Deallocated %@ (0x%x) sent %@",
NSStringFromClass(c), o, NSStringFromSelector(sel));
}
if (GSEnvironmentFlag("CRASH_ON_ZOMBIE", NO) == YES)
{
abort();
}
}