[EMAIL PROTECTED] wrote:
Hi,
My program uses xerces-2.7.0 and xalan-c-1.10. It performs a loop calling
successively:
XMLPlatformUtils::Initialize();
XalanTransformer::initialize();

// some code

XalanTransformer::terminate();
XMLPlatformUtils::Terminate();

The 1rst loop is ok, but it cores at the second one.

This is not supported. The comments on XalanTransformer::initialize() and XalanTransformer:terminate() make this clear:

    /**
     * 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.
     */
    static void
initialize(MemoryManager& theManager = XalanMemMgrs::getDefaultXercesMemMgr());

    /**
     * Terminate Xalan.
     *
     * Should be called only once per process after deleting all
     * 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.
     *
     * This is handy when using leak-detection software, as all
     * static data allocated by Xalan is freed.
     *
     */
    static void
    terminate();

The comments in header files are there to help you use the library properly, so you should really consider reading them.

Also, you certainly don't want to to these operations in a loop, as they are _extremely_ expensive. They are meant to be called on a per-process basis.

Dave

Reply via email to