Yes to everything.  The code sample you show below will not leak, and your
assumptions are right.  As you said, unless you do
> funky deliberate library loading, the lib gets loaded once as the
> program executes and is unloaded when the program finishes.

And, I left out a strategic "not", ...

> > This is different from just calling Initialize multiple times, which
does
> > NOT cause leaks.

  -- Andy



----- Original Message -----
From: "Michael Mason" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, March 28, 2000 1:10 AM
Subject: Re: memory leaks


> Andy Heninger wrote:
> >
> > Be aware that there will be leaks if you repeatedly dynamically load and
> > unload the xerces-c library.  The initialization happens over each time.
> > This is different from just calling Initialize multiple times, which
does
> > cause leaks.
>
> But if I've got a program that's linked to the dynamic library and
> doesn't do any explicit loading or unloading of libraries, the Xerces-C
> lib won't get unloaded and reloaded, right? I mean something like
> (functions probably all wrong, I haven't looked at the init code for a
> while):
>
> int main(void) {
>
>   while(some_condition) {
>     XMLPlatformUtils::initialize();
>     // Create parser, do something, output some stuff, destroy parser.
>   }
>   return 0;
> }
>
> That thing won't leak, right? I'm coming at this from a Unix background
> and tend to use statically linked stuff, but I had assumed unless you do
> funky deliberate library loading, the lib gets loaded once as the
> program executes and is unloaded when the program finishes.
>
> Cheers,
> Mike.
>
> --
> Mike Mason, Software Engineer
> XML Script Development Team                    Office: 44-1865-203192
> http://www.xmlscript.org/                      Mobile: 44-7050-288923
>

Reply via email to