Change 27396 by [EMAIL PROTECTED] on 2006/03/06 22:18:52
Don't free thread memory if PERL_DESTRUCT_LEVEL is set to a non-zero
value as we're probably hunting memory leaks then
Affected files ...
... //depot/perl/perl.c#738 edit
Differences ...
==== //depot/perl/perl.c#738 (text) ====
Index: perl/perl.c
--- perl/perl.c#737~27359~ 2006-03-01 14:39:24.000000000 -0800
+++ perl/perl.c 2006-03-06 14:18:52.000000000 -0800
@@ -1289,10 +1289,19 @@
perl_free(pTHXx)
{
#ifdef PERL_TRACK_MEMPOOL
- /* Emulate the PerlHost behaviour of free()ing all memory allocated in this
- thread at thread exit. */
- while(aTHXx->Imemory_debug_header.next != &(aTHXx->Imemory_debug_header))
- safesysfree(sTHX + (char *)(aTHXx->Imemory_debug_header.next));
+ {
+ /*
+ * Don't free thread memory if PERL_DESTRUCT_LEVEL is set to a non-zero
+ * value as we're probably hunting memory leaks then
+ */
+ const char * const s = PerlEnv_getenv("PERL_DESTRUCT_LEVEL");
+ if (!s || atoi(s) == 0) {
+ /* Emulate the PerlHost behaviour of free()ing all memory allocated
in this
+ thread at thread exit. */
+ while(aTHXx->Imemory_debug_header.next !=
&(aTHXx->Imemory_debug_header))
+ safesysfree(sTHX + (char *)(aTHXx->Imemory_debug_header.next));
+ }
+ }
#endif
#if defined(WIN32) || defined(NETWARE)
End of Patch.