develooper Front page | perl.perl5.porters | Postings from February 2001

[PATCH perl 5.7.0] malloc message address offset

Thread Next
From:
lane
Date:
February 22, 2001 05:00
Subject:
[PATCH perl 5.7.0] malloc message address offset
Message ID:
010222075625.9d22e@DUPHY4.Physics.Drexel.Edu
I'm not 100% sure that what I'm patching here isn't "intended behavior".
If so, you guys *will* let me know, right?

I was trying out "Perl's malloc" to see if the added diagnostic information
would be useful for tracking down memory leaks (not so far).  But noticed
that the malloc/free messages that you get when running with -Dm don't
quite match up with what I've come to expect...

That is, the malloc addresses are offset 4 bytes with respect to the
address for "free" and "realloc".

Should it do this? I'd guess not, so here's a patch to rectify it:

--- malloc.c-orig	Thu Feb  8 15:11:04 2001
+++ malloc.c	Thu Feb  8 15:10:48 2001
@@ -1096,7 +1096,7 @@
 
 	DEBUG_m(PerlIO_printf(Perl_debug_log,
 			      "0x%"UVxf": (%05lu) malloc %ld bytes\n",
-			      PTR2UV(p+1), (unsigned long)(PL_an++),
+			      PTR2UV(p), (unsigned long)(PL_an++),
 			      (long)size));
 
 	/* remove from linked list */
--
 Drexel University       \V                    --Chuck Lane
======]---------->--------*------------<-------[===========
     (215) 895-1545     _/ \  Particle Physics
FAX: (215) 895-5934     /\ /~~~~~~~~~~~        lane@duphy4.physics.drexel.edu

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About