in reply to Re: out of memory! (again!)
in thread out of memory! (again!)

based on that hint, line 169:
$crosslevel[$endlevel++];
should probably read:
$crosslevel[$endlevel]++;