in reply to Re^4: XML::Twig too many children?
in thread XML::Twig too many children?

Yup, it's a stack overflow:

$ valgrind perl a.pl ==17235== Memcheck, a memory error detector ==17235== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et +al. ==17235== Using Valgrind-3.6.0.SVN-Debian and LibVEX; rerun with -h fo +r copyright info ==17235== Command: perl a.pl ==17235== ==17235== Stack overflow in thread 1: can't grow stack to 0xbe01ef78 ==17235== ...

The more I think about it, the less I think it's a bug in XML::Parser. I think it's a bug in how Perl destroys deeply nested structures, which may or may not be fixable.

There are few places where the C code that forms perl itself recurses, and those can lead to overflows of the limited-sized "C stack" (as opposed to the "Perl stack" the script uses), and this appears to be one of them.

Updated after I remembered valgrind.