Any Dr. Watson (or coredump/segfault on a Unix box) in perl is a bug in the perl interpreter or in any loaded DLLs/XS modules. You should not be able to write a script which would cause this.
Having said that, no software is bug free and one of the best ways of getting it to fail is to use too much memory.
Hmm...I attempted to do a quick example of how perl handles memory exhaustion gracefully and ended up causing a segfault on perl 5.6.0 (un-upgraded install on Red Hat 7.2) with the following:
sub big {
$line = shift;
$size = length $line;
print "Size is [$size]\n";
$line = $line x $size;
big( $line );
}
big( "12" );
Running with a 3-char string to start causes different behaviour (big allocations, box slows down with memory use, perl finally prints "Out of memory!" and exits cleanly), which is more what I expected.
I really should go and grab a more recent perl and if this is fixed and/or big into the allocator and see why it doesn't like big powers of two. But I'm sure someone here will happily beat me to it :-) |