I run a regex against a large scalar. Although this match does not capture anything, my process is growing by 30 million after this match:
if (${$c} =~ m/\G<<\s*/cgs)
{
...
}
$c- a link to a rather large scalar (about 21 M), but I confirmed that I pos(${$c})was in the right place, and the expression matches the first character, while pos(${$c})updating to the right place after the match. But, as I mentioned, the process grew by about 30M between #A and #B, although I am not collecting anything in this match. Where does my memory go?
Edit: Yes, use $&was to blame. We use Perl 5.8.8, and my script used Getopt :: Declare , which uses the built-in Text :: Balanced . The 1.95 version of this module used $&. Version 2.0.0, which ships with Perl 5.10, removed the link to $&and fixes the problem.
source
share