You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Mu...@GDM.DE on 2000/07/26 08:19:38 UTC

Initialize/Terminate (was memory leaks in XMLPlatformUtils::Initialize() (v.1.0 .1))


Joe Polastre wrote:

> This is the short term fix.  If you want to be able to call Init and Term
> multiple times, someone is going to have to do a bit more work.

I understand that it's difficult, but it seems that this multiple
Initialize/Terminate absolutely NEEDS to be supported. Or maybe somebody
can explain how these situations are not a problem:

1) Two applications (each with a main()) use a shared Xerces library. One
calls Terminate. Can the other still use Xerces? Can the other call
Initialize()? Maybe Initialize can be called again after Xerces has been
unloaded, but how do we have any knowledge/control of that?

2) A library uses Xerces, but it is not acceptable to change the interface
of that library to add Intialize/Terminate functions. Anyway, this would
just pass problem 1) up the chain.

For instance, I have written a Unix/Windows C++ library that uses Xerces-C
and is wrapped by a Java class via JNI. I now have no idea where to put the
call to Initialize(). Also, it is now not very clear whether I really need
to call Terminate().

Murray Cumming
murrayc@usa.net
www.murrayc.com


Re: Initialize/Terminate (was memory leaks in XMLPlatformUtils::Initialize() (v.1.0.1))

Posted by Dean Roddey <dr...@charmedquark.com>.
> 1) Two applications (each with a main()) use a shared Xerces library. One
> calls Terminate. Can the other still use Xerces? Can the other call
> Initialize()? Maybe Initialize can be called again after Xerces has been
> unloaded, but how do we have any knowledge/control of that?
>

This is not a problem. The two instances will share code pages (in most
systems) but otherwise, there is no relationship. They each have completely
separate data pages.

> 2) A library uses Xerces, but it is not acceptable to change the interface
> of that library to add Intialize/Terminate functions. Anyway, this would
> just pass problem 1) up the chain.
>
> For instance, I have written a Unix/Windows C++ library that uses Xerces-C
> and is wrapped by a Java class via JNI. I now have no idea where to put
the
> call to Initialize(). Also, it is now not very clear whether I really need
> to call Terminate().
>

If Java doesn't provide a way to clean up when the process exits, or when a
class is unloaded, then it could be problematic. OTOH, I kind of find it
hard to believe that we are the only C++ code out there that is wrapped by
Java and which does not provide for arbritrary de-initialization, right? How
are other people in the Java world dealing with this situation?

--------------------------
Dean Roddey
The CIDLib C++ Frameworks
Charmed Quark Software
droddey@charmedquark.com
http://www.charmedquark.com

"You young, and you gotcha health. Whatchoo wanna job fer?"