Skip Menu |
Report information
Id: 123974
Status: new
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: avuserow [at]

Severity: (no value)
Tag: (no value)
Platform: (no value)
Patch Status: (no value)
VM: (no value)

To: rakudobug [...]
Subject: Running regex on string defined in a loop eats tons of memory
From: Adrian Kreher <avuserow [...]>
Date: Tue, 03 Mar 2015 10:44:44 -0800
This is perl6 version 2015.02-157-g28fddba built on MoarVM version 2015.02-17-g86d0c68, running on Fedora 21 x64. (All memory usages gathered via maxresident from /usr/bin/time) Things that eat a lot of memory: /usr/bin/time perl6 -e'for 1 .. 1000 {my $a = "a" x 1_000_000; $a ~~ /./;}' 4010652maxresident /usr/bin/time perl6 -e'for 1 .. 1000 {my $a = "a" x 1_000_000; $a ~~ /z/;}' 3775768maxresident /usr/bin/time perl6 -e'my $a; my $i = 0; while $i < 1000 {$a = "a" x 1_000_000; $a ~~ /./; $i++};' 4011284maxresident For these cases, if I replace 1000 with 100, then I use right around 500MB in these cases. JVM does not appear to be affected or affected as badly, as I can ramp up 1000 to 10000 and still be around 1GB. Things that don't consume tons of memory: /usr/bin/time perl6 -e'my $a = "a" x 1_000_000; for 1 .. 1000 {$a ~~ /./;}' 106320maxresident /usr/bin/time perl6 -e'for 1 .. 1000 {my $a = "a" x 1_000_000; $a.chars}' 92552maxresident (Note that my real use case has distinct values since they are being read from a file with similar line-length characteristics.)

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at