This is pretty interesting. It worked fine with 5.6.1 and 5.8.0 on freebsd. It caused 5.8.2 to segfault on my debian box where 5.8.0 and 5.6.1 ran fine. It also crashed AS 5.8.2 whereas AS 5.6.1 ran fine under windows. Seems to be a 5.8.2 problem.
Also, increasing $MAX to 200 makes the problem go away with both.
Update: On 5.8.2 under debian, it segfaults for $MAX between 66 and 125 as well as between 254 and 354 (stopped testing at 400). On AS 5.8.2 it crashes for $MAX between 65 and 125. It also crashes with 255 and above (stopped testing at 275 since whenever it crashes, it brings up that window which I have to click). If you'd like to test it yourself, use the following:
#!/usr/bin/perl use strict; use warnings; my $MAX = shift; my $re = qr /^(1+)(??{"(?:$1){" . (length ($1) - 1) . "}" })$/; for (1 .. $MAX) {printf "%3d is a square\n" => $_ if (1 x $_) =~ /$re/} do {printf "%3d is a square\n" => $_ if (1 x $_) =~ /$re/} for 1 .. $ +MAX; map {printf "%3d is a square\n" => $_ if (1 x $_) =~ /$re/} 1 .. $ +MAX;
Windows:
perl -le "print $_,system(qq{perl script.pl $_ > dump.out})?' NOK':' o +k' for (1..275)"
*nix:
perl -le'print $_,$",system("perl script.pl $_ > /dev/null")?"NOK":"ok +" for (1..275)'
Update 2: I've compiled 5.6.2 and 5.9.0 and tested it on both. Surprisingly, it fails for $MAX set to 125. In fact, every version of perl I tested on every platform I tested failed when $MAX was set to 125. Odd.
antirice
The first rule of Perl club is - use Perl
The ith rule of Perl club is - follow rule i - 1 for i > 1
In reply to Re: Unexpected 'Out of Memory'
by antirice
in thread Unexpected 'Out of Memory'
by Abigail-II
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |