develooper Front page | perl.perl5.porters | Postings from September 2000

Re: [ID 20000807.004] [PATCH] conditional breakpoints leak memory

From:
Mike Guy
Date:
September 1, 2000 06:16
Subject:
Re: [ID 20000807.004] [PATCH] conditional breakpoints leak memory
Message ID:
E13Uqfp-0006dN-00@draco.cus.cam.ac.uk
Embarrassingly long ago, Jarkko Hietaniemi <jhi@iki.fi> wrote
> On Tue, Aug 08, 2000 at 10:04:23PM +0100, Mike Guy wrote:
> > [1] But like I said earlier  -  don't use it.  It's broke.   :-(
>
> Could you send it to me directly?

Here's the part of the patch which mends the leaks associated with
'D', 'L' and 'A' magic, and also one I discovered later with 'd' magic.

The rest of the patch was attempting to mend assorted minor bugs in
toke.c associated with debugger input lines.   This didn't work.
It seems like a rather more radical attack on toke.c is needed to
sort this stuff out.    I should have been warned by finding the same
code written out six times ...     I'll try to produce a subsequent
patch for this, but it won't be in time for 5.7.0 (or even 5.6.1).


Mike Guy

--- ./mg.c.orig	Fri Sep  1 13:55:18 2000
+++ ./mg.c	Fri Sep  1 13:56:01 2000
@@ -292,7 +292,8 @@
     for (mg = SvMAGIC(sv); mg; mg = mg->mg_moremagic) {
 	if (isUPPER(mg->mg_type)) {
 	    sv_magic(nsv,
-		     mg->mg_type == 'P' ? SvTIED_obj(sv, mg) : mg->mg_obj,
+		     mg->mg_type == 'P' ? SvTIED_obj(sv, mg) :
+		     (mg->mg_type == 'D' && mg->mg_obj) ? sv : mg->mg_obj,
 		     toLOWER(mg->mg_type), key, klen);
 	    count++;
 	}
--- ./gv.c.orig	Fri Sep  1 13:55:18 2000
+++ ./gv.c	Fri Sep  1 12:06:03 2000
@@ -75,7 +75,7 @@
 	gv_init(gv, PL_defstash, tmpbuf, tmplen, FALSE);
 	sv_setpv(GvSV(gv), name);
 	if (PERLDB_LINE)
-	    hv_magic(GvHVn(gv_AVadd(gv)), gv, 'L');
+	    hv_magic(GvHVn(gv_AVadd(gv)), Nullgv, 'L');
     }
     if (tmpbuf != smallbuf)
 	Safefree(tmpbuf);
@@ -735,7 +735,7 @@
         if (strEQ(name, "OVERLOAD")) {
             HV* hv = GvHVn(gv);
             GvMULTI_on(gv);
-            hv_magic(hv, gv, 'A');
+            hv_magic(hv, Nullgv, 'A');
         }
         break;
     case 'S':
@@ -749,7 +749,7 @@
 	    }
 	    GvMULTI_on(gv);
 	    hv = GvHVn(gv);
-	    hv_magic(hv, gv, 'S');
+	    hv_magic(hv, Nullgv, 'S');
 	    for (i = 1; PL_sig_name[i]; i++) {
 	    	SV ** init;
 	    	init = hv_fetch(hv, PL_sig_name[i], strlen(PL_sig_name[i]), 1);

End of patch



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