This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
adjust output of -Dm
authorDavid Mitchell <davem@iabyn.com>
Sun, 31 Oct 2010 10:31:56 +0000 (10:31 +0000)
committerDavid Mitchell <davem@iabyn.com>
Sun, 31 Oct 2010 11:54:02 +0000 (11:54 +0000)
The address printed for malloc() didn't always match that for free().
Print the malloc() address *after* any modification by PERL_TRACK_MEMPOOL

util.c

diff --git a/util.c b/util.c
index 20429f7..f0b472a 100644 (file)
--- a/util.c
+++ b/util.c
@@ -99,7 +99,6 @@ Perl_safesysmalloc(MEM_SIZE size)
 #endif
     ptr = (Malloc_t)PerlMem_malloc(size?size:1);       /* malloc(0) is NASTY on our system */
     PERL_ALLOC_CHECK(ptr);
-    DEBUG_m(PerlIO_printf(Perl_debug_log, "0x%"UVxf": (%05ld) malloc %ld bytes\n",PTR2UV(ptr),(long)PL_an++,(long)size));
     if (ptr != NULL) {
 #ifdef PERL_TRACK_MEMPOOL
        struct perl_memory_debug_header *const header
@@ -122,6 +121,7 @@ Perl_safesysmalloc(MEM_SIZE size)
 #  endif
         ptr = (Malloc_t)((char*)ptr+sTHX);
 #endif
+       DEBUG_m(PerlIO_printf(Perl_debug_log, "0x%"UVxf": (%05ld) malloc %ld bytes\n",PTR2UV(ptr),(long)PL_an++,(long)size));
        return ptr;
 }
     else {