diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2005-07-11 00:50:27 +0300 |
---|---|---|
committer | Dave Mitchell <davem@fdisolutions.com> | 2005-07-10 20:02:07 +0000 |
commit | 46c6c7e2a233df6079f4ba33374086db68feb889 (patch) | |
tree | 14af74d6519da21bdf4ef22ad2bc87af73f102b4 /util.c | |
parent | 255164ba591da7065b6ce749c4e1de6c0711b5fd (diff) | |
download | perl-46c6c7e2a233df6079f4ba33374086db68feb889.tar.gz |
yet another way of debugging memory allocations
Message-ID: <42D16DF3.4040806@gmail.com>
tweak PERL_MEM_LOG
p4raw-id: //depot/perl@25109
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 21 |
1 files changed, 11 insertions, 10 deletions
@@ -4961,42 +4961,43 @@ Perl_free_global_struct(pTHX_ struct perl_vars *plvarsp) #ifdef PERL_MEM_LOG Malloc_t -Perl_mem_log_alloc(const UV n, const UV typesize, const char *typename, Malloc_t newalloc, const char *filename, const int linenumber) +Perl_mem_log_alloc(const UV n, const UV typesize, const char *typename, Malloc_t newalloc, const char *filename, const int linenumber, const char *funcname) { #ifdef PERL_MEM_LOG_STDERR /* We can't use PerlIO_printf() for obvious reasons. */ char buf[1024]; sprintf(buf, - "alloc: %s:%d: %"IVdf" %"UVuf" %s = %"IVdf": %p\n", - filename, linenumber, - n, typesize, typename, n * typesize, newalloc); + "alloc: %s:%d:%s: %"IVdf" %"UVuf" %s = %"IVdf": %"UVxf"\n", + filename, linenumber, funcname, + n, typesize, typename, n * typesize, PTR2UV(newalloc)); write(2, buf, strlen(buf)); #endif return newalloc; } Malloc_t -Perl_mem_log_realloc(const UV n, const UV typesize, const char *typename, Malloc_t oldalloc, Malloc_t newalloc, const char *filename, const int linenumber) +Perl_mem_log_realloc(const UV n, const UV typesize, const char *typename, Malloc_t oldalloc, Malloc_t newalloc, const char *filename, const int linenumber, const char *funcname) { #ifdef PERL_MEM_LOG_STDERR /* We can't use PerlIO_printf() for obvious reasons. */ char buf[1024]; sprintf(buf, - "realloc: %s:%d: %"IVdf" %"UVuf" %s = %"IVdf": %p -> %p\n", - filename, linenumber, - n, typesize, typename, n * typesize, oldalloc, newalloc); + "realloc: %s:%d:%s: %"IVdf" %"UVuf" %s = %"IVdf": %"UVxf" -> %"UVxf"\n", + filename, linenumber, funcname, + n, typesize, typename, n * typesize, PTR2UV(oldalloc), PTR2UV(newalloc)); write(2, buf, strlen(buf)); #endif return newalloc; } Malloc_t -Perl_mem_log_free(Malloc_t oldalloc, const char *filename, const int linenumber) +Perl_mem_log_free(Malloc_t oldalloc, const char *filename, const int linenumber, const char *funcname) { #ifdef PERL_MEM_LOG_STDERR /* We can't use PerlIO_printf() for obvious reasons. */ char buf[1024]; - sprintf(buf, "free: %s:%d: %p\n", filename, linenumber, oldalloc); + sprintf(buf, "free: %s:%d:%s: %"UVxf"\n", + filename, linenumber, funcname, PTR2UV(oldalloc)); write(2, buf, strlen(buf)); #endif return oldalloc; |