The docs for XalanTransformer::initialize say --
void XalanTransformer::initialize ( MemoryManagerType & theManager =
XalanMemMgrs::getDefaultXercesMemMgr() ) [static]
Initialize Xalan.
Should be called only once per process before creating any instances of
XalanTransformer. This call is not thread-safe, so you must serialize
any calls to it, and you must track the initialization state, so you do
not call it more than once.
------
My application is a server, and it only intermittently needs to call the
xerces/xalan stuff to serialize current state. I'd prefer to initialize
these libraries only when I need them and then release them when I'm
done (thus getting back any memory that they might be holding on to).
So, I tried just doing the initialization and termination before and
after my serialization:
//initialization:
XMLPlatformUtils::Initialize();
XalanTransformer::initialize();
//DO SERIALIZATION WORK
//termination
XalanTransformer::terminate();
XMLPlatformUtils::Terminate();
XalanTransformer::ICUCleanUp();
This violates the docs for initialize, which will be called here each
time I try to serialize, but my application does not crash with my basic
tests.
Does anyone have experience doing this? In general, why can't
initialize/terminate be called multiple times (like
XMLPlatformUtils::Initialize can)?
Advice appreciated.
-Mike Ellery