Perl_eval_pv() leaks 4 bytes every time it is called because it
Gurusamy Sarathy [Tue, 6 Jun 2000 00:42:59 +0000 (00:42 +0000)]
does a PUSHMARK that's never ever POPMARKed; in general, only
Perl_call_[sp]v() need a PUSHMARK for incoming arguments;
Perl_eval_[sp]v() don't because they don't take any incoming
arguments (this leak has been around since the original version
of perl_eval_pv() in 5.003_97e)

p4raw-id: //depot/perl@6201

perl.c

diff --git a/perl.c b/perl.c
index 801dbe1..ade1d3c 100644 (file)
--- a/perl.c
+++ b/perl.c
@@ -1784,9 +1784,9 @@ S_call_body(pTHX_ OP *myop, int is_eval)
 
     if (PL_op == myop) {
        if (is_eval)
-           PL_op = Perl_pp_entereval(aTHX);
+           PL_op = Perl_pp_entereval(aTHX);    /* this doesn't do a POPMARK */
        else
-           PL_op = Perl_pp_entersub(aTHX);
+           PL_op = Perl_pp_entersub(aTHX);     /* this does */
     }
     if (PL_op)
        CALLRUNOPS(aTHX);
@@ -1908,7 +1908,6 @@ Perl_eval_pv(pTHX_ const char *p, I32 croak_on_error)
     dSP;
     SV* sv = newSVpv(p, 0);
 
-    PUSHMARK(SP);
     eval_sv(sv, G_SCALAR);
     SvREFCNT_dec(sv);