From 1cac5c33e290951fde33491aa5d8e730051f56f8 Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Tue, 13 Nov 2012 21:54:32 -0800 Subject: [PATCH] Fix various mad eval leaks Several SVs that exist for the sake of mad dumps were being set up even for normal execution. --- t/op/svleak.t | 27 +++++++++++---------------- toke.c | 26 +++++++++++++++++--------- 2 files changed, 28 insertions(+), 25 deletions(-) diff --git a/t/op/svleak.t b/t/op/svleak.t index 95e1a3a..0b4db43 100644 --- a/t/op/svleak.t +++ b/t/op/svleak.t @@ -15,7 +15,7 @@ BEGIN { use Config; -plan tests => 67; +plan tests => 68; # run some code N times. If the number of SVs at the end of loop N is # greater than (N-1)*delta at the end of loop 1, we've got a leak @@ -32,13 +32,12 @@ sub leak { cmp_ok($sv1-$sv0, '<=', ($n-1)*$delta, @rest); } -# Like leak, but run a string eval instead; takes into account existing -# string eval leaks under -Dmad (except when -Dmad leaks two or -# more SVs). The code is used instead of the test name +# Like leak, but run a string eval instead. +# The code is used instead of the test name # if the name is absent. sub eleak { my ($n,$delta,$code,@rest) = @_; - leak $n, $delta + !!$Config{mad}, sub { eval $code }, + leak $n, $delta, sub { eval $code }, @rest ? @rest : $code } @@ -189,12 +188,9 @@ leak(2,0,sub { !$^V }, '[perl #109762] version object in boolean context'); # [perl #114356] run-time rexexp with unchanging pattern got # inflated refcounts +eleak(2, 0, q{ my $x = "x"; "abc" =~ /$x/ for 1..5 }, '#114356'); -SKIP: { - skip "disabled under -Dmad (eval leaks)" if $Config{mad}; - leak(2, 0, sub { eval q{ my $x = "x"; "abc" =~ /$x/ for 1..5 } }, '#114356'); -} - +eleak(2, 0, 'sub', '"sub" with nothing following'); eleak(2, 0, '+sub:a{}', 'anon subs with invalid attributes'); eleak(2, 0, 'no warnings; sub a{1 1}', 'sub with syntax error'); eleak(2, 0, 'no warnings; sub {1 1}', 'anon sub with syntax error'); @@ -204,7 +200,7 @@ eleak(2, 0, '"${<