Thanks for your suggestions. See the post above for an example that causes a crash. I did try using
, but it didn't make a difference. The lexicals are not getting thrown away, because the program produces the correct output. It is just a matter of the interpreter crashing after the script is finished, probably during garbage collection.