Yes - you must! Or if you want to re-use it you should call reset(). If your server accepts a connection and passes off to a worker thread for parsing you create a parser. IDOMParser *pParser = new IDOMParser; At the end of the processing loop you need to free it: delete pParser;
Jim > -----Original Message----- > From: Jason Jesso [mailto:[EMAIL PROTECTED]] > Sent: Monday, December 10, 2001 11:15 AM > To: [EMAIL PROTECTED] > Subject: Re: xerces and threads > > > I am confused. Can I free each parser? > > "Murphy, James" wrote: > > > > The server will create a thread for each connection made and > > > in turn an > > > IDOMParser. When the connection is terminated, can I free up > > > that individual > > > parser? > > > > Yes, your heap will thank you for it! Most of the dynamic > memory consumed > > during an IDOMParser:parse operation comes from a heap > local to the parser. > > FWIU, This was much of the point of the IDOM project. > failing to free it > > will leak _lots_ of memory - you would have found it before > long I'm sure! > > > > BTW, I hope you are considering a threadpool instead of > creating a new > > thread for each connection. > > > > > > > Or is all memory cleaned up when Terminate() is called? I > > > could have many, > > > many connections and the server can run a long time. I > > > wouldn't want to run > > > out of memory. > > > > Terminate just frees some globals - not parser allocated > memory. Call it > > once at server shutdown (if at all). > > > > Jim > > > > > --------------------------------------------------------------------- > > 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]
