diff options
author | Nicholas Clark <nick@ccl4.org> | 2008-02-27 16:45:20 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2008-02-27 16:45:20 +0000 |
commit | 4fd0a9b8690ace1bad89926e6d018a6f863761c3 (patch) | |
tree | 8c1ac30b00bf4ee9d91af555ca77fca10eb6dd27 /perl.c | |
parent | 291f766ec79ed2f8f09e116381515c07bad45726 (diff) | |
download | perl-4fd0a9b8690ace1bad89926e6d018a6f863761c3.tar.gz |
Do the memory debug header fixup earlier to avoid valgrind screaming
under -Dm. Also, temporarily disable memory logging during thread
memory freeing, as otherwise we try to log using memory we already
freed.
p4raw-id: //depot/perl@33388
Diffstat (limited to 'perl.c')
-rw-r--r-- | perl.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -1376,10 +1376,17 @@ perl_free(pTHXx) */ const char * const s = PerlEnv_getenv("PERL_DESTRUCT_LEVEL"); if (!s || atoi(s) == 0) { + const U32 old_debug = PL_debug; /* Emulate the PerlHost behaviour of free()ing all memory allocated in this thread at thread exit. */ + if (DEBUG_m_TEST) { + PerlIO_puts(Perl_debug_log, "Disabling memory debugging as we " + "free this thread's memory\n"); + PL_debug &= ~ DEBUG_m_FLAG; + } while(aTHXx->Imemory_debug_header.next != &(aTHXx->Imemory_debug_header)) safesysfree(sTHX + (char *)(aTHXx->Imemory_debug_header.next)); + PL_debug = old_debug; } } #endif |