summaryrefslogtreecommitdiff
path: root/pp_ctl.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2001-03-12 16:04:47 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2001-03-12 16:04:47 +0000
commit282f25c977e1960e4e088425df8229fa6a4a7563 (patch)
tree7a794b96486fbe8f27d0860af1dadc2c79e432aa /pp_ctl.c
parentfd5f5d222ad399d968d7e5e208df1abd8e5e88ea (diff)
downloadperl-282f25c977e1960e4e088425df8229fa6a4a7563.tar.gz
Integrate change #9108 from maintperl to mainline.
fix memory leak in C<sub X { sub {} }> arising from a refcount loop between the outer sub and the inner prototype anonsub this also enables closures returned by subroutines that subsequently get redefined to work without generating coredumps :) completely removed the free_closures() hack--it shouldn't be needed anymore p4raw-link: @9108 on //depot/maint-5.6/perl: 1cf1f64f42eb50a67f2427ff9d6d24023a2b9997 p4raw-id: //depot/perl@9109 p4raw-branched: from //depot/maint-5.6/perl@9107 'branch in' t/op/anonsub.t p4raw-integrated: from //depot/maint-5.6/perl@9107 'merge in' sv.c (@8871..) embed.h (@8886..) pod/perlapi.pod proto.h (@8993..) embed.pl (@8995..) MANIFEST (@9030..) op.c op.h (@9055..) pp_ctl.c (@9076..)
Diffstat (limited to 'pp_ctl.c')
-rw-r--r--pp_ctl.c40
1 files changed, 0 insertions, 40 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index 8985cca9a2..ede5abad97 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -1380,41 +1380,6 @@ Perl_dounwind(pTHX_ I32 cxix)
}
}
-/*
- * Closures mentioned at top level of eval cannot be referenced
- * again, and their presence indirectly causes a memory leak.
- * (Note that the fact that compcv and friends are still set here
- * is, AFAIK, an accident.) --Chip
- *
- * XXX need to get comppad et al from eval's cv rather than
- * relying on the incidental global values.
- */
-STATIC void
-S_free_closures(pTHX)
-{
- SV **svp = AvARRAY(PL_comppad_name);
- I32 ix;
- for (ix = AvFILLp(PL_comppad_name); ix >= 0; ix--) {
- SV *sv = svp[ix];
- if (sv && sv != &PL_sv_undef && *SvPVX(sv) == '&') {
- SvREFCNT_dec(sv);
- svp[ix] = &PL_sv_undef;
-
- sv = PL_curpad[ix];
- if (CvCLONE(sv)) {
- SvREFCNT_dec(CvOUTSIDE(sv));
- CvOUTSIDE(sv) = Nullcv;
- }
- else {
- SvREFCNT_dec(sv);
- sv = NEWSV(0,0);
- SvPADTMP_on(sv);
- PL_curpad[ix] = sv;
- }
- }
- }
-}
-
void
Perl_qerror(pTHX_ SV *err)
{
@@ -1951,8 +1916,6 @@ PP(pp_return)
POPEVAL(cx);
if (CxTRYBLOCK(cx))
break;
- if (AvFILLp(PL_comppad_name) >= 0)
- free_closures();
lex_end();
if (optype == OP_REQUIRE &&
(MARK == SP || (gimme == G_SCALAR && !SvTRUE(*SP))) )
@@ -3507,9 +3470,6 @@ PP(pp_leaveeval)
}
PL_curpm = newpm; /* Don't pop $1 et al till now */
- if (AvFILLp(PL_comppad_name) >= 0)
- free_closures();
-
#ifdef DEBUGGING
assert(CvDEPTH(PL_compcv) == 1);
#endif