Put them within a conditional check for the reason in DllMain - call
Initialize only when the reason == DLL_PROCESS_ATTACH and call terminate
when reason == DLL_PROCESS_DETACH. Your DllMain will be called each time a
thread is created after the DLL is loaded - this results in multiple calls
to your DllMain. Also consider calling DisableThreadLibraryCalls to prevent
this behavior.
Regards,
Jim
> -----Original Message-----
> From: Prior, Chris [mailto:[EMAIL PROTECTED]]
> Sent: Monday, July 09, 2001 11:50 AM
> To: '[EMAIL PROTECTED]'
> Subject: RE: 'DOMParser' memory problems
>
>
> Well, as far as I know (which is not a lot!) memory checkers
> will report
> leaks when there are none but the memory will still be released.
>
> However, I really would try to code for calling Init and Term
> once in your
> process lifetime only.
>
> You can do this a number of ways - if you want to limit the XML
> functionality to just your DLL you will have to use a mutex
> or semaphore or
> something (this allows for your dll to be loaded and unloaded
> from a process
> and when the thread of the process that loaded you up dies
> then the locking
> object you are using will be released).
>
> Hope this helps,
>
> Chris Prior
> -----Original Message-----
> From: john guildesh [mailto:[EMAIL PROTECTED]]
> Sent: 09 July 2001 16:47
> To: [EMAIL PROTECTED]
> Subject: RE: 'DOMParser' memory problems
>
>
> Dear Chris,
>
> Thank you very much...
>
> If I do not call Terminate(), it works!!!
>
> But, wich are the risks of not calling Terminate()???
>
> Regards,
>
> On Mon, 09 July 2001, "Prior, Chris" wrote:
>
> >
> > Is your Dll being loaded and unloaded and then loaded again?
> >
> > Check it DllMain.
> >
> > A couple of things you can do:
> >
> > 1. Don't call Terminate (memory is still released)
> > 2. Put in a mutex to guard against calling Initialize after
> Terminate in a
> > process.
> >
> > Good luck.
> >
> > Chris Prior
> >
> > -----Original Message-----
> > From: john guildesh [mailto:[EMAIL PROTECTED]]
> > Sent: 09 July 2001 16:36
> > To: [EMAIL PROTECTED]
> > Subject: RE: 'DOMParser' memory problems
> >
> >
> > I do not think so.
> >
> > Inside the DLL, I call:
> >
> > XMLPlatformUtils::Initialize();
> > ...
> > XMLPlatformUtils::Terminate();
> >
> > (and only once).
> >
> > The first time, it does not crash, but the second time it
> does. And it
> > crashes not at 'Initialize()', but at 'DOMParser parser'.
> >
> > Must I empty 'parser' variable????
> >
> >
> >
> > On Mon, 09 July 2001, Jesse Pelton wrote:
> >
> > >
> > > Are you calling XMLPlatformUtils::Initialize() more than once per
> process?
> > > If so, that's your problem. See the FAQ.
> > >
> > > -----Original Message-----
> > > From: john guildesh [mailto:[EMAIL PROTECTED]]
> > > Sent: Monday, July 09, 2001 10:38 AM
> > > To: [EMAIL PROTECTED]
> > > Subject: 'DOMParser' memory problems
> > >
> > >
> > > Hi!
> > >
> > > Working with Visual C++ 6.0 and Xerces-C 1.4.0.
> > >
> > > I've just created a DLL to Parse an XML document. When
> calling it once,
> > > there is no problem, but there is a problem if I call it twice.
> > >
> > > At the second time, I get:
> > >
> > > ("instruction xxx makes reference to the memory...")
> > >
> > > Just when executing:
> > >
> > > // Instantiate the DOM parser.
> > > DOMParser parser;
> > >
> > > Anybody's got experience dealing with this topic?
> > > Must I change my Xerces-C version???
> > >
> > > Regards,
> > >
> > >
> > >
> ______________________________________________________________
> _________
> > > Get a FREE email address for your WILD SIDE! Choose from over 350
> > > outrageous email addresses at http://www.WildEmail.com
> > >
> > >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> > >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
> ______________________________________________________________
> _________
> > Get a FREE email address for your WILD SIDE! Choose from over 350
> > outrageous email addresses at http://www.WildEmail.com
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> > ___________________________________________________
> > Email Disclaimer
> >
> > This communication is for the attention of the
> > named recipient only and should not be passed
> > on to any other person. Information relating to
> > any company or security, is for information
> > purposes only and should not be interpreted as
> > a solicitation or offer to buy or sell any security.
> > The information on which this communication is based
> > has been obtained from sources we believe to be reliable,
> > but we do not guarantee its accuracy or completeness.
> > All expressions of opinion are subject to change
> > without notice. All e-mail messages, and associated attachments,
> > are subject to interception and monitoring for lawful
> business purposes.
> > ___________________________________________________
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> ______________________________________________________________
> _________
> Get a FREE email address for your WILD SIDE! Choose from over 350
> outrageous email addresses at http://www.WildEmail.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]