Then I discovered this wonderful little gem:
EmbeddedPerl *ep3 = new EmbeddedPerl();
EmbeddedPerl *ep2 = new EmbeddedPerl();
crashes my test rig. It turns up there is some bug in my code where if you have multiple interpreters defined at the same time in the same thread the perl_destroy() code doesn't do deallocation properly of the stack on the second instance (at least on Win32, that is).
Shit. Looks like the one XS module I have in the entire stack is not threadsafe. But this isn't even a thread-safeness issue since both interpreters are on the same thread. It's really multiplicity.
I'm going home now. I really need someone to help me write a series of test cases for my Embedded Perl. Marty, where the hell are you?
P.S. Xerces leaks about six kilobytes per instance of the interpreter. Need to look at whether their SWIG bindings expect some explicit deallocation routine to be called in an END block or something.