Skip to content

Instantly share code, notes, and snippets.

@wolfsage
Created September 23, 2011 17:26
Show Gist options
  • Save wolfsage/1237945 to your computer and use it in GitHub Desktop.
Save wolfsage/1237945 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl
use strict;
use warnings;
my $string = 'x' x (1024 * 1024 * 8);
print "Before match\n";
$string =~ /x/;
print "After plain match\n";
$string =~ /(x)/;
print "After capturing match\n";
__END__
mhorsfall@darmstadtium:~$ perl -d:MemoryTrace::Light tm.pl
>> 11608 main, tm.pl (6) used 16752640 bytes
Before match
After plain match
>> 11608 main, tm.pl (14) used 8380416 bytes
After capturing match
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment