But the more likely cause of my headache is that I have, I think, figured out the multiple sources of our massive memory leaks.
Every call that we made to the MSXML interface leaked, because the fellow who wrote the wrapper for the interface didn't write virtual destructors for the base classes in his XML DOM Factory class. As a result, when you deleted the pointer to the base class, you did not delete the derived class that held the _com_ptr_t that was wrappering the COM interface classes for MSXML. A massive memory leak followed.
In many places in our code, we were assigning BSTR pointers to _bstr_t wrappers instead of attaching them. As a result, the BSTRs were never deleted. A massive memory leak followed.
And we did the same thing in the JNI interface, but added the sin of allocating BSTRs with the wrong function, making extra copies of BSTRs, etc. I think the JNI interface leaked every string that passed through it. It may have leaked some of them twice. A massive memory leak followed.
I just finished rebuilding the JNI with what I believe are the fixes to the BSTR handling.
We'll see how it does...