diff options
-rw-r--r-- | pod/perldelta.pod | 9 | ||||
-rw-r--r-- | regcomp.c | 7 |
2 files changed, 11 insertions, 5 deletions
diff --git a/pod/perldelta.pod b/pod/perldelta.pod index 22ecd27c49..7f65ef60c4 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -589,6 +589,15 @@ L</Modules and Pragmata>. =item * +RT #78266: The regex engine has been leaking memory when accessing +named captures that weren't matched as part of a regex ever since 5.10 +when they were introduced, e.g. this would consume over a hundred MB +of memory: + + perl -wle 'for (1..10_000_000) { if ("foo" =~ /(foo|(?<capture>bar))?/) { my $capture = $+{capture} } } system "ps -o rss $$"' + +=item * + A constant subroutine assigned to a glob whose name contains a null will no longer cause extra globs to pop into existence when the constant is referenced under its new name. @@ -5409,7 +5409,8 @@ Perl_reg_named_buff_fetch(pTHX_ REGEXP * const r, SV * const namesv, if (!retarray) return ret; } else { - ret = newSVsv(&PL_sv_undef); + if (retarray) + ret = newSVsv(&PL_sv_undef); } if (retarray) av_push(retarray, ret); @@ -5418,10 +5419,6 @@ Perl_reg_named_buff_fetch(pTHX_ REGEXP * const r, SV * const namesv, return newRV_noinc(MUTABLE_SV(retarray)); } } - - if (ret) - SvREFCNT_dec(ret); - return NULL; } |