Skip to content

Instantly share code, notes, and snippets.

@berekuk
Created January 13, 2011 13:40
Show Gist options
  • Save berekuk/777860 to your computer and use it in GitHub Desktop.
Save berekuk/777860 to your computer and use it in GitHub Desktop.
# I've found this problem initially by using Coro with XML::LibXML;
# XML::LibXML::Error object on large invalid documents can contain lots of nested objects
sub more_nesting {
return bless { x => shift } => "A"
}
sub build_deep {
my $depth = shift;
my $x;
$x = more_nesting($x) for 1..shift();
undef $x; # segfault happens at this point
}
# number varies on various systems and perl versions;
# perl5.8 breaks somewhere between 20k and 30k, perl5.10 even before 20k
build_deep(30_000);
use Coro;
async(sub {
build_deep(300) # critical number for my perl/system is 291
})->join;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment