-
Notifications
You must be signed in to change notification settings - Fork 602
Open
Labels
Description
Description
Since v5.19.1, perl has leaked memory when built with COW and a successful match occurs.
Steps to Reproduce
The following is based upon https://benchmarksgame-team.pages.debian.net/benchmarksgame/program/regexredux-perl-1.html and takes the same input of FASTA string. Comments show the approximate memory usage at each step.
# approx 50 MB input file.
my $seq = do { local $/; <STDIN> };
# 5.16.3 approx 102 MB RAM used at this point
# 5.18.0 approx 102 MB RAM used at this point
# 5.19.1 & later approx 55 MB RAM used at this point
$seq =~ s/>.*\n//g;
# 5.16.3 102 MB used
# 5.18.4: 102 MB used
# 5.19.1 & later 102 MB used
$seq =~ s/t/<4>/g;
# 5.16.3 175 MB used
# 5.18.4 175 MB used
# 5.19.1 & later 176 MB used
$seq =~ s/DS/<3>/g;
# 5.16.3 198 MB used
# 5.18.4 198 MB used
# 5.19.1 & later 248 MB used
$seq =~ s/NS/<2>/g;
# 5.16.3 197 MB used
# 5.18.4 197 MB used
# 5.19.1 & later 321 MB used
$seq =~ s/2/1/g;
# 5.16.3 197 MB used
# 5.18.4 197 MB used
# 5.19.1 & later 395 MB used
$seq =~ s/3/1/g;
# etc etc
Expected behavior
Memory use reaches a steady level (e.g. 100 - 200 MB here), rather than going up by approx the size of the input string with each successful match.
Perl configuration
Any perl since v5.19.1 with COW enabled.