X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=malloc.c;h=e6484016176bfb9452cabe33e7d10ddc1c39de05;hb=8fa7688f7865696bdfa78bc12d4ffb78bd1d6103;hp=450b6a257a2fb8993cb84f089109646e3cd66348;hpb=9014280dc8264580f076d4325a59f22a11592058;p=p5sagit%2Fp5-mst-13.2.git diff --git a/malloc.c b/malloc.c index 450b6a2..e648401 100644 --- a/malloc.c +++ b/malloc.c @@ -356,9 +356,16 @@ #ifdef DEBUGGING # undef DEBUG_m -# define DEBUG_m(a) \ +# define DEBUG_m(a) \ STMT_START { \ - if (PERL_GET_INTERP) { dTHX; if (DEBUG_m_TEST) { a; } } \ + if (PERL_GET_INTERP) { \ + dTHX; \ + if (DEBUG_m_TEST) { \ + PL_debug &= ~DEBUG_m_FLAG; \ + a; \ + PL_debug |= DEBUG_m_FLAG; \ + } \ + } \ } STMT_END #endif @@ -923,7 +930,7 @@ static u_int goodsbrk; static char *emergency_buffer; static MEM_SIZE emergency_buffer_size; -static int no_mem; /* 0 if the last request for more memory succeeded. +static MEM_SIZE no_mem; /* 0 if the last request for more memory succeeded. Otherwise the size of the failing request. */ static Malloc_t @@ -1103,11 +1110,6 @@ Perl_malloc(register size_t nbytes) return (NULL); } - DEBUG_m(PerlIO_printf(Perl_debug_log, - "0x%"UVxf": (%05lu) malloc %ld bytes\n", - PTR2UV(p), (unsigned long)(PL_an++), - (long)size)); - /* remove from linked list */ #if defined(RCHECK) if ((PTR2UV(p)) & (MEM_ALIGNBYTES - 1)) { @@ -1128,6 +1130,11 @@ Perl_malloc(register size_t nbytes) MALLOC_UNLOCK; + DEBUG_m(PerlIO_printf(Perl_debug_log, + "0x%"UVxf": (%05lu) malloc %ld bytes\n", + PTR2UV((Malloc_t)(p + CHUNK_SHIFT)), (unsigned long)(PL_an++), + (long)size)); + #ifdef IGNORE_SMALL_BAD_FREE if (bucket >= FIRST_BUCKET_WITH_CHECK) #endif @@ -1160,7 +1167,7 @@ Perl_malloc(register size_t nbytes) static char *last_sbrk_top; static char *last_op; /* This arena can be easily extended. */ -static int sbrked_remains; +static MEM_SIZE sbrked_remains; static int sbrk_good = SBRK_ALLOW_FAILURES * SBRK_FAILURE_PRICE; #ifdef DEBUGGING_MSTATS