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 Dean Roddey <dr...@charmedquark.com> on 2000/11/21 02:30:03 UTC
Re: Successive calls to the DOMParser::parse() method does not re
lease memory used until the object is destroyed.
I don't know what to tell you. No one else is reporting memory leaks, and
people do beat on it pretty hard. Unless you can do a little leg work to get
some idea of what's leaking, there isn't much that anyone can do for you.
Xerces if a free product, and though the people who work on it want to fix
any problems that can be found, they are limited in what they can do for
you. Do some work to see what might be causing it. For instance, instead of
throwing all of your different files at it, throw some particular kinds at
it. If one type creates the problem and the others don't, post that
information and it might help someone chase down a potential bug.
Most importantly though, do something like make the most minimal changes
possible to the DOMCount sample so that it loops and parses your list of
files. If it doesn't leak, then it will be something related to how you are
using the parser. If it does, then you can send the Xerces folks some of
your files and the minimal changes you made to the sample and they can try
to find out the leak point.
--------------------------
Dean Roddey
The CIDLib C++ Frameworks
Charmed Quark Software
droddey@charmedquark.com
http://www.charmedquark.com
"It takes two buttocks to make friction"
- African Proverb
----- Original Message -----
From: "Samarah, Mohammed" <ms...@harris.com>
To: <xe...@xml.apache.org>
Sent: Monday, November 20, 2000 9:56 AM
Subject: RE: Successive calls to the DOMParser::parse() method does not re
lease memory used until the object is destroyed.
> I ran the same test as before but this time with xerces-c_1_3D.dll and
> xerces-c_1_3.dll libraries; however, my memory usage is still increasing
for
> each file processed.
>
> In this particular test, the memory usage went from 8,448K to 33,824K
after
> processing 1159 files. My application is expected to process a large
volume of
> files (50,000 to 100,000+) everyday without user intervention. How can I
work
> around this issue?
>
> Your help is greatly appreciated in solving this problem,
> Mohammad
>
> > -----Original Message-----
> > From: Dean Roddey [SMTP:droddey@portal.com]
> > Sent: Friday, November 17, 2000 6:12 PM
> > To: 'xerces-c-dev@xml.apache.org'
> > Subject: RE: Successive calls to the DOMParser::parse() method does not
> > re lease memory used until the object is destroyed.
> >
> > Oh... duh, I got you mixed up with someone else who was dealing wiht
some
> > leaks, so I'd never gone back and looked at your code below in the
message
> > because I thought I already had. The obvious problem you have is that
you
> > are running version 1.1.0, or at least that is what you reported below.
> > Upgrade to 1.3.0 (the most recent vresion) you will probably be fine.
> >
> > --------------
> > Dean Roddey
> > Software Geek Extraordinaire
> > Portal, Inc
> > droddey@portal.com
> >
> >
> >
> > -----Original Message-----
> > From: Samarah, Mohammed [mailto:msamarah@harris.com]
> > Sent: Friday, November 17, 2000 2:59 PM
> > To: xerces-c-dev@xml.apache.org
> > Subject: RE: Successive calls to the DOMParser::parse() method does not
> > re lease memory used until the object is destroyed.
> >
> >
> > I am actually invoking the parser using a data file and not a memory
buffer!
> > I
> > am also using the production version of xerces-c_1_1.dll library from
the
> > distribution zip file. However, my testing was conducted with both a
release
> > and
> > debug version of my application.
> >
> > Thanks for your help,
> > Mohammad
> >
> >
> > -----Original Message-----
> > From: Dean Roddey [SMTP:droddey@portal.com]
> > Sent: Friday, November 17, 2000 5:44 PM
> > To: 'xerces-c-dev@xml.apache.org'
> > Subject: RE: Successive calls to the DOMParser::parse()
> > method
> > does not re lease memory used until the object is destroyed.
> >
> > Just a sanity check, why no do the following...
> >
> > Put in a little code to write the data to a file, then parse from
> > the
> > file.
> > You'd get rid of any of the memory buffer input source code. If that
> > makes
> > it go away, then the places to look would be dramatically smaller,
> > since
> > it
> > would probably have to be in some memory buffer stuff.
> >
> >
> > Oh... are you sure that you are consistently using the same C/C++
> > runtime?
> > I.e. if you are using our non-debug DLL, you must build your code
> > for
> > non-debug. Otherwise, you can be allocating memory from one place
> > and
> > freeing it from another, such as the memory passed in for the
> > buffers
> > you
> > are parsing. Generally this will cause errors, but not always,
> > according
> > to
> > whether you are using the non-debug runtime in the one where the
> > error
> > should happen. So either use our debug DLL and make your app use the
> > 'multi-threaded DLL debug" runtime, or use our production DLL and
> > make
> > your
> > app use the 'mutlti-threaded DLL' runtime.
> >
> > --------------
> > Dean Roddey
> > Software Geek Extraordinaire
> > Portal, Inc
> > droddey@portal.com
> >
> >
> >
> > -----Original Message-----
> > From: Samarah, Mohammed [mailto:msamarah@harris.com]
> > Sent: Friday, November 17, 2000 2:32 PM
> > To: xerces-c-dev@xml.apache.org
> > Subject: RE: Successive calls to the DOMParser::parse() method does
> > not
> > re lease memory used until the object is destroyed.
> >
> >
> > Yes, the memory usage increases after each parse and never goes
> > down.
> > The
> > increase of memory utilization is proportional to the number of
> > files
> > processed.
> >
> > -----Original Message-----
> > From: Dean Roddey [SMTP:droddey@portal.com]
> > Sent: Friday, November 17, 2000 5:24 PM
> > To: 'xerces-c-dev@xml.apache.org'
> > Subject: RE: Successive calls to the
> > DOMParser::parse()
> > method
> > does not re lease memory used until the object is destroyed.
> >
> > Do you mean it keeps going up? Keep in mind that any memory
> > held
> > by
> > the
> > parser in something like the DOM tree will likely remain
> > until
> > you
> > destroy
> > that parser instance or do the next parse. So if you just
> > see
> > extra
> > memory
> > after each parse, but its not continuing to creep upwards,
> > then
> > that's
> > probably normal.
> >
> > However, I doubt that its the parse, because these types of
> > continuous
> > runs
> > while monitoring memory usage are done before each release,
> > AFAIK,
> > and
> > probably other people do them when they get the new parse
> > code
> > and
> > would
> > have reported it.
> >
> > The reset methods are protected and are called from the
> > scanner
> > to
> > reset
> > the
> > target parser before a new parse event, so they are not for
> > you
> > to
> > call.
> >
> > --------------
> > Dean Roddey
> > Software Geek Extraordinaire
> > Portal, Inc
> > droddey@portal.com
> >
> >
> >
> > -----Original Message-----
> > From: Samarah, Mohammed [mailto:msamarah@harris.com]
> > Sent: Friday, November 17, 2000 2:19 PM
> > To: xerces-c-dev@xml.apache.org
> > Subject: RE: Successive calls to the DOMParser::parse()
> > method
> > does
> > not
> > re lease memory used until the object is destroyed.
> >
> >
> > I am still tracking this problem down. I have removed all
> > dynamic
> > memory
> > allocations out of my application, nevertheless, my memory
> > utilization
> > increases
> > by an unpredictable amount (as little as 0k to 80k or more)
> > per
> > file
> > processed
> > through the DOM parser until the machine runs out of memory
> > and
> > then
> > the
> > application dies. However, If I take out the call to parse
> > the
> > file
> > as
> > shown
> > below the memory utilization stabilizes:
> >
> > // From <parsers/DOMParser.hpp>
> > void parse(const char* const systemId, const
> > bool
> > reuseValidator
> > = false);
> >
> > // m_pDOMParser->parse(pszXMLFile)
> >
> > Do I need to call another method to reset the parser after
> > each
> > file
> > processed?
> > I have found a "reset()" and "resetDocument()" methods in
> > the
> > "parsers/DOMParser.hpp" file, what is the purpose of these
> > methods?
> > Also, do
> > I
> > need to set the "reuseValidator" flag in calls to the parse
> > method?
> >
> > Your help is greatly appreciated in solving this critical
> > problem,
> > Mohammad
> >
> > > -----Original Message-----
> > > From: Dean Roddey [SMTP:droddey@charmedquark.com]
> > > Sent: Tuesday, November 07, 2000 9:03 PM
> > > To: xerces-c-dev@xml.apache.org
> > > Subject: Re: Successive calls to the
> > DOMParser::parse()
> > method
> > does
> > not
> > > release memory used until the object is destroyed.
> > >
> > > Its probably an Initialize/Terminate thing. Call
> > Initialize()
> > once
> > at
> > > program startup and Terminate() once at program shutdown.
> > >
> > > --------------------------
> > > Dean Roddey
> > > The CIDLib C++ Frameworks
> > > Charmed Quark Software
> > > droddey@charmedquark.com
> > > http://www.charmedquark.com
> > >
> > > "It takes two buttocks to make friction"
> > > - African Proverb
> > >
> > >
> > > ----- Original Message -----
> > > From: "Samarah, Mohammed" <ms...@harris.com>
> > > To: <xe...@xml.apache.org>
> > > Sent: Tuesday, November 07, 2000 2:01 PM
> > > Subject: Successive calls to the DOMParser::parse() method
> > does
> > not
> > release
> > > memory used until the object is destroyed.
> > >
> > >
> > > > I am using the Xerces-C++ parser in a high volume
> > background
> > application.
> > > > Everything seems to work as expected except that my
> > memory
> > usage
> > keeps
> > on
> > > > increasing as more files are processed. My debugger does
> > not
> > show
> > any
> > > memory
> > > > leaks, and the memory appears to be released after the
> > DOMParser
> > object
> > is
> > > > destroyed.
> > > >
> > > > I expect my application to run for weeks at a time,
> > processing
> > 50,000
> > > files or
> > > > more daily. Do I need to perform any cleanup after each
> > successive
> > call
> > to
> > > the
> > > > DOMParser::parse() method?
> > > >
> > > > The code that invokes the XML parser and my environment
> > parameters
> > are
> > > show
> > > > below.
> > > >
> > > > Your help is greatly appreciated,
> > > > --Mohammad
> > > >
> > > > Environment:
> > > > Xerces-C 1.1.0
> > > > OS: NT4+SP6
> > > > Dev. Tools: Visual C++ 6.0
> > > >
> > > > Code:
> > > > // while more files and process is running
> > > > while ((bMore) && (pDirProc->isRunning()))
> > > > {
> > > > // if a file of attribute normal or archive
> > > > if ((oFindData.attrib == _A_NORMAL) || (oFindData.attrib
> > ==
> > _A_ARCH))
> > > > {
> > > > // if file was processed successfully
> > > > if (pDirProc->m_oProc.ProcessFile(strFile.c_str()) ==
> > > > CzXMLProcessor::ZXMLP_STATUS_OK)
> > > > {
> > > > // store file in the database
> > > > // ...
> > > > }
> > > > }
> > > > // get next file
> > > > bMore = (_findnext(lSearch, &oFindData) == 0);
> > > > }
> > > >
> > > > CzXMLDOMProcessor::CzXMLDOMProcessor()
> > > > {
> > > > // clear data members
> > > > Clear();
> > > >
> > > > try
> > > > {
> > > > // initialize the XML4C system
> > > > XMLPlatformUtils::Initialize();
> > > >
> > > > // create a DOM parser
> > > > m_pDOMParser = new DOMParser;
> > > >
> > > > // if parser was allocated successfully
> > > > if (m_pDOMParser != NULL)
> > > > {
> > > > // set error handler
> > > > m_pDOMParser->setErrorHandler(&m_handler);
> > > >
> > > > // set initialized flag
> > > > m_bXMLInit = true;
> > > > }
> > > > }
> > > > // catch XMLException
> > > > catch (const XMLException& toCatch)
> > > > {
> > > > // save error message and set error status
> > > > CStrX x(toCatch.getMessage());
> > > > setLastError(x.getLocalForm());
> > > > }
> > > > }
> > > >
> > > > CzXMLDOMProcessor::~CzXMLDOMProcessor()
> > > > {
> > > > // free previous allocation if necessary
> > > > if (m_XMLData.pszSummary != NULL)
> > > > {
> > > > delete [] m_XMLData.pszSummary;
> > > > }
> > > > if (m_XMLData.pszBodyContent != NULL)
> > > > {
> > > > delete [] m_XMLData.pszBodyContent;
> > > > }
> > > > if (m_pDOMParser != NULL)
> > > > {
> > > > delete m_pDOMParser;
> > > > }
> > > > }
> > > >
> > > > short CzXMLDOMProcessor::ProcessFile(const char
> > *pszXMLFile)
> > > > {
> > > > // set return status
> > > > short nStatus = ZXMLP_STATUS_INIT_ERR;
> > > >
> > > > // if parser has been initialized
> > > > if (m_bXMLInit)
> > > > {
> > > > // clear last error
> > > > setLastError("");
> > > >
> > > >
> > m_handler.setLastError(CzXMLProcessorHandlers::ZXMLP_STATUS_NONE);
> > > > m_handler.setLastErrorMsg("");
> > > >
> > > > try
> > > > {
> > > > // parse the file
> > > > m_pDOMParser->parse(pszXMLFile);
> > > >
> > > > // if error parsing file
> > > > if (m_handler.getLastError() !=
> > > > CzXMLProcessorHandlers::ZXMLP_STATUS_NONE)
> > > > {
> > > > // save error message and set error status
> > > > setLastError(m_handler.getLastErrorMsg());
> > > > nStatus = ZXMLP_STATUS_FATAL_ERR;
> > > > }
> > > > else
> > > > {
> > > > // process tags and set success status
> > > > ProcessTags(pszXMLFile,
> > > > m_pDOMParser->getDocument());
> > > > nStatus = ZXMLP_STATUS_OK;
> > > > }
> > > >
> > > > }
> > > > // catch XMLException
> > > > catch (const XMLException& toCatch)
> > > > {
> > > > // save error message and set error status
> > > > CStrX x(toCatch.getMessage());
> > > > setLastError(x.getLocalForm());
> > > > nStatus = ZXMLP_STATUS_FATAL_ERR;
> > > > }
> > > > }
> > > >
> > > > // return status
> > > > return(nStatus);
> > > > }
> > > >
> > > >
> >
> > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail:
> > xerces-c-dev-unsubscribe@xml.apache.org
> > > > For additional commands, e-mail:
> > xerces-c-dev-help@xml.apache.org
> > > >
> > >
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > xerces-c-dev-unsubscribe@xml.apache.org
> > > For additional commands, e-mail:
> > xerces-c-dev-help@xml.apache.org
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > xerces-c-dev-unsubscribe@xml.apache.org
> > For additional commands, e-mail:
> > xerces-c-dev-help@xml.apache.org
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> > xerces-c-dev-unsubscribe@xml.apache.org
> > For additional commands, e-mail:
> > xerces-c-dev-help@xml.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>
Re: Successive calls to the DOMParser::parse() method does not release memory used until the object is destroyed.
Posted by "Joel C. Lim" <jl...@ntsp.nec.co.jp>.
Our investigation yielded the same results. I think the problem is the fact
that the DOMParser
object does'nt get garbage collected instantly. It is not a leak(to
omoimasu) :-).
The object is not eligible for garbage collection yet. If my assumptions
are correct, is there a
way to force it to be garbage collected in xerces-c?
joel
Software Design Engineer
NEC Telecom Software Philippines, Inc.
----- Original Message -----
From: Dean Roddey <dr...@charmedquark.com>
To: <xe...@xml.apache.org>
Sent: Tuesday, November 21, 2000 10:30 AM
Subject: Re: Successive calls to the DOMParser::parse() method does not
release memory used until the object is destroyed.
> I don't know what to tell you. No one else is reporting memory leaks, and
> people do beat on it pretty hard. Unless you can do a little leg work to
get
> some idea of what's leaking, there isn't much that anyone can do for you.
> Xerces if a free product, and though the people who work on it want to fix
> any problems that can be found, they are limited in what they can do for
> you. Do some work to see what might be causing it. For instance, instead
of
> throwing all of your different files at it, throw some particular kinds at
> it. If one type creates the problem and the others don't, post that
> information and it might help someone chase down a potential bug.
>
> Most importantly though, do something like make the most minimal changes
> possible to the DOMCount sample so that it loops and parses your list of
> files. If it doesn't leak, then it will be something related to how you
are
> using the parser. If it does, then you can send the Xerces folks some of
> your files and the minimal changes you made to the sample and they can try
> to find out the leak point.
>
> --------------------------
> Dean Roddey
> The CIDLib C++ Frameworks
> Charmed Quark Software
> droddey@charmedquark.com
> http://www.charmedquark.com
>
> "It takes two buttocks to make friction"
> - African Proverb
>
>
> ----- Original Message -----
> From: "Samarah, Mohammed" <ms...@harris.com>
> To: <xe...@xml.apache.org>
> Sent: Monday, November 20, 2000 9:56 AM
> Subject: RE: Successive calls to the DOMParser::parse() method does not re
> lease memory used until the object is destroyed.
>
>
> > I ran the same test as before but this time with xerces-c_1_3D.dll and
> > xerces-c_1_3.dll libraries; however, my memory usage is still increasing
> for
> > each file processed.
> >
> > In this particular test, the memory usage went from 8,448K to 33,824K
> after
> > processing 1159 files. My application is expected to process a large
> volume of
> > files (50,000 to 100,000+) everyday without user intervention. How can I
> work
> > around this issue?
> >
> > Your help is greatly appreciated in solving this problem,
> > Mohammad
> >
> > > -----Original Message-----
> > > From: Dean Roddey [SMTP:droddey@portal.com]
> > > Sent: Friday, November 17, 2000 6:12 PM
> > > To: 'xerces-c-dev@xml.apache.org'
> > > Subject: RE: Successive calls to the DOMParser::parse() method does
not
> > > re lease memory used until the object is destroyed.
> > >
> > > Oh... duh, I got you mixed up with someone else who was dealing wiht
> some
> > > leaks, so I'd never gone back and looked at your code below in the
> message
> > > because I thought I already had. The obvious problem you have is that
> you
> > > are running version 1.1.0, or at least that is what you reported
below.
> > > Upgrade to 1.3.0 (the most recent vresion) you will probably be fine.
> > >
> > > --------------
> > > Dean Roddey
> > > Software Geek Extraordinaire
> > > Portal, Inc
> > > droddey@portal.com
> > >
> > >
> > >
> > > -----Original Message-----
> > > From: Samarah, Mohammed [mailto:msamarah@harris.com]
> > > Sent: Friday, November 17, 2000 2:59 PM
> > > To: xerces-c-dev@xml.apache.org
> > > Subject: RE: Successive calls to the DOMParser::parse() method does
not
> > > re lease memory used until the object is destroyed.
> > >
> > >
> > > I am actually invoking the parser using a data file and not a memory
> buffer!
> > > I
> > > am also using the production version of xerces-c_1_1.dll library from
> the
> > > distribution zip file. However, my testing was conducted with both a
> release
> > > and
> > > debug version of my application.
> > >
> > > Thanks for your help,
> > > Mohammad
> > >
> > >
> > > -----Original Message-----
> > > From: Dean Roddey [SMTP:droddey@portal.com]
> > > Sent: Friday, November 17, 2000 5:44 PM
> > > To: 'xerces-c-dev@xml.apache.org'
> > > Subject: RE: Successive calls to the DOMParser::parse()
> > > method
> > > does not re lease memory used until the object is destroyed.
> > >
> > > Just a sanity check, why no do the following...
> > >
> > > Put in a little code to write the data to a file, then parse from
> > > the
> > > file.
> > > You'd get rid of any of the memory buffer input source code. If that
> > > makes
> > > it go away, then the places to look would be dramatically smaller,
> > > since
> > > it
> > > would probably have to be in some memory buffer stuff.
> > >
> > >
> > > Oh... are you sure that you are consistently using the same C/C++
> > > runtime?
> > > I.e. if you are using our non-debug DLL, you must build your code
> > > for
> > > non-debug. Otherwise, you can be allocating memory from one place
> > > and
> > > freeing it from another, such as the memory passed in for the
> > > buffers
> > > you
> > > are parsing. Generally this will cause errors, but not always,
> > > according
> > > to
> > > whether you are using the non-debug runtime in the one where the
> > > error
> > > should happen. So either use our debug DLL and make your app use the
> > > 'multi-threaded DLL debug" runtime, or use our production DLL and
> > > make
> > > your
> > > app use the 'mutlti-threaded DLL' runtime.
> > >
> > > --------------
> > > Dean Roddey
> > > Software Geek Extraordinaire
> > > Portal, Inc
> > > droddey@portal.com
> > >
> > >
> > >
> > > -----Original Message-----
> > > From: Samarah, Mohammed [mailto:msamarah@harris.com]
> > > Sent: Friday, November 17, 2000 2:32 PM
> > > To: xerces-c-dev@xml.apache.org
> > > Subject: RE: Successive calls to the DOMParser::parse() method does
> > > not
> > > re lease memory used until the object is destroyed.
> > >
> > >
> > > Yes, the memory usage increases after each parse and never goes
> > > down.
> > > The
> > > increase of memory utilization is proportional to the number of
> > > files
> > > processed.
> > >
> > > -----Original Message-----
> > > From: Dean Roddey [SMTP:droddey@portal.com]
> > > Sent: Friday, November 17, 2000 5:24 PM
> > > To: 'xerces-c-dev@xml.apache.org'
> > > Subject: RE: Successive calls to the
> > > DOMParser::parse()
> > > method
> > > does not re lease memory used until the object is destroyed.
> > >
> > > Do you mean it keeps going up? Keep in mind that any memory
> > > held
> > > by
> > > the
> > > parser in something like the DOM tree will likely remain
> > > until
> > > you
> > > destroy
> > > that parser instance or do the next parse. So if you just
> > > see
> > > extra
> > > memory
> > > after each parse, but its not continuing to creep upwards,
> > > then
> > > that's
> > > probably normal.
> > >
> > > However, I doubt that its the parse, because these types of
> > > continuous
> > > runs
> > > while monitoring memory usage are done before each release,
> > > AFAIK,
> > > and
> > > probably other people do them when they get the new parse
> > > code
> > > and
> > > would
> > > have reported it.
> > >
> > > The reset methods are protected and are called from the
> > > scanner
> > > to
> > > reset
> > > the
> > > target parser before a new parse event, so they are not for
> > > you
> > > to
> > > call.
> > >
> > > --------------
> > > Dean Roddey
> > > Software Geek Extraordinaire
> > > Portal, Inc
> > > droddey@portal.com
> > >
> > >
> > >
> > > -----Original Message-----
> > > From: Samarah, Mohammed [mailto:msamarah@harris.com]
> > > Sent: Friday, November 17, 2000 2:19 PM
> > > To: xerces-c-dev@xml.apache.org
> > > Subject: RE: Successive calls to the DOMParser::parse()
> > > method
> > > does
> > > not
> > > re lease memory used until the object is destroyed.
> > >
> > >
> > > I am still tracking this problem down. I have removed all
> > > dynamic
> > > memory
> > > allocations out of my application, nevertheless, my memory
> > > utilization
> > > increases
> > > by an unpredictable amount (as little as 0k to 80k or more)
> > > per
> > > file
> > > processed
> > > through the DOM parser until the machine runs out of memory
> > > and
> > > then
> > > the
> > > application dies. However, If I take out the call to parse
> > > the
> > > file
> > > as
> > > shown
> > > below the memory utilization stabilizes:
> > >
> > > // From <parsers/DOMParser.hpp>
> > > void parse(const char* const systemId, const
> > > bool
> > > reuseValidator
> > > = false);
> > >
> > > // m_pDOMParser->parse(pszXMLFile)
> > >
> > > Do I need to call another method to reset the parser after
> > > each
> > > file
> > > processed?
> > > I have found a "reset()" and "resetDocument()" methods in
> > > the
> > > "parsers/DOMParser.hpp" file, what is the purpose of these
> > > methods?
> > > Also, do
> > > I
> > > need to set the "reuseValidator" flag in calls to the parse
> > > method?
> > >
> > > Your help is greatly appreciated in solving this critical
> > > problem,
> > > Mohammad
> > >
> > > > -----Original Message-----
> > > > From: Dean Roddey [SMTP:droddey@charmedquark.com]
> > > > Sent: Tuesday, November 07, 2000 9:03 PM
> > > > To: xerces-c-dev@xml.apache.org
> > > > Subject: Re: Successive calls to the
> > > DOMParser::parse()
> > > method
> > > does
> > > not
> > > > release memory used until the object is destroyed.
> > > >
> > > > Its probably an Initialize/Terminate thing. Call
> > > Initialize()
> > > once
> > > at
> > > > program startup and Terminate() once at program shutdown.
> > > >
> > > > --------------------------
> > > > Dean Roddey
> > > > The CIDLib C++ Frameworks
> > > > Charmed Quark Software
> > > > droddey@charmedquark.com
> > > > http://www.charmedquark.com
> > > >
> > > > "It takes two buttocks to make friction"
> > > > - African Proverb
> > > >
> > > >
> > > > ----- Original Message -----
> > > > From: "Samarah, Mohammed" <ms...@harris.com>
> > > > To: <xe...@xml.apache.org>
> > > > Sent: Tuesday, November 07, 2000 2:01 PM
> > > > Subject: Successive calls to the DOMParser::parse() method
> > > does
> > > not
> > > release
> > > > memory used until the object is destroyed.
> > > >
> > > >
> > > > > I am using the Xerces-C++ parser in a high volume
> > > background
> > > application.
> > > > > Everything seems to work as expected except that my
> > > memory
> > > usage
> > > keeps
> > > on
> > > > > increasing as more files are processed. My debugger does
> > > not
> > > show
> > > any
> > > > memory
> > > > > leaks, and the memory appears to be released after the
> > > DOMParser
> > > object
> > > is
> > > > > destroyed.
> > > > >
> > > > > I expect my application to run for weeks at a time,
> > > processing
> > > 50,000
> > > > files or
> > > > > more daily. Do I need to perform any cleanup after each
> > > successive
> > > call
> > > to
> > > > the
> > > > > DOMParser::parse() method?
> > > > >
> > > > > The code that invokes the XML parser and my environment
> > > parameters
> > > are
> > > > show
> > > > > below.
> > > > >
> > > > > Your help is greatly appreciated,
> > > > > --Mohammad
> > > > >
> > > > > Environment:
> > > > > Xerces-C 1.1.0
> > > > > OS: NT4+SP6
> > > > > Dev. Tools: Visual C++ 6.0
> > > > >
> > > > > Code:
> > > > > // while more files and process is running
> > > > > while ((bMore) && (pDirProc->isRunning()))
> > > > > {
> > > > > // if a file of attribute normal or archive
> > > > > if ((oFindData.attrib == _A_NORMAL) || (oFindData.attrib
> > > ==
> > > _A_ARCH))
> > > > > {
> > > > > // if file was processed successfully
> > > > > if (pDirProc->m_oProc.ProcessFile(strFile.c_str()) ==
> > > > > CzXMLProcessor::ZXMLP_STATUS_OK)
> > > > > {
> > > > > // store file in the database
> > > > > // ...
> > > > > }
> > > > > }
> > > > > // get next file
> > > > > bMore = (_findnext(lSearch, &oFindData) == 0);
> > > > > }
> > > > >
> > > > > CzXMLDOMProcessor::CzXMLDOMProcessor()
> > > > > {
> > > > > // clear data members
> > > > > Clear();
> > > > >
> > > > > try
> > > > > {
> > > > > // initialize the XML4C system
> > > > > XMLPlatformUtils::Initialize();
> > > > >
> > > > > // create a DOM parser
> > > > > m_pDOMParser = new DOMParser;
> > > > >
> > > > > // if parser was allocated successfully
> > > > > if (m_pDOMParser != NULL)
> > > > > {
> > > > > // set error handler
> > > > > m_pDOMParser->setErrorHandler(&m_handler);
> > > > >
> > > > > // set initialized flag
> > > > > m_bXMLInit = true;
> > > > > }
> > > > > }
> > > > > // catch XMLException
> > > > > catch (const XMLException& toCatch)
> > > > > {
> > > > > // save error message and set error status
> > > > > CStrX x(toCatch.getMessage());
> > > > > setLastError(x.getLocalForm());
> > > > > }
> > > > > }
> > > > >
> > > > > CzXMLDOMProcessor::~CzXMLDOMProcessor()
> > > > > {
> > > > > // free previous allocation if necessary
> > > > > if (m_XMLData.pszSummary != NULL)
> > > > > {
> > > > > delete [] m_XMLData.pszSummary;
> > > > > }
> > > > > if (m_XMLData.pszBodyContent != NULL)
> > > > > {
> > > > > delete [] m_XMLData.pszBodyContent;
> > > > > }
> > > > > if (m_pDOMParser != NULL)
> > > > > {
> > > > > delete m_pDOMParser;
> > > > > }
> > > > > }
> > > > >
> > > > > short CzXMLDOMProcessor::ProcessFile(const char
> > > *pszXMLFile)
> > > > > {
> > > > > // set return status
> > > > > short nStatus = ZXMLP_STATUS_INIT_ERR;
> > > > >
> > > > > // if parser has been initialized
> > > > > if (m_bXMLInit)
> > > > > {
> > > > > // clear last error
> > > > > setLastError("");
> > > > >
> > > > >
> > > m_handler.setLastError(CzXMLProcessorHandlers::ZXMLP_STATUS_NONE);
> > > > > m_handler.setLastErrorMsg("");
> > > > >
> > > > > try
> > > > > {
> > > > > // parse the file
> > > > > m_pDOMParser->parse(pszXMLFile);
> > > > >
> > > > > // if error parsing file
> > > > > if (m_handler.getLastError() !=
> > > > > CzXMLProcessorHandlers::ZXMLP_STATUS_NONE)
> > > > > {
> > > > > // save error message and set error status
> > > > > setLastError(m_handler.getLastErrorMsg());
> > > > > nStatus = ZXMLP_STATUS_FATAL_ERR;
> > > > > }
> > > > > else
> > > > > {
> > > > > // process tags and set success status
> > > > > ProcessTags(pszXMLFile,
> > > > > m_pDOMParser->getDocument());
> > > > > nStatus = ZXMLP_STATUS_OK;
> > > > > }
> > > > >
> > > > > }
> > > > > // catch XMLException
> > > > > catch (const XMLException& toCatch)
> > > > > {
> > > > > // save error message and set error status
> > > > > CStrX x(toCatch.getMessage());
> > > > > setLastError(x.getLocalForm());
> > > > > nStatus = ZXMLP_STATUS_FATAL_ERR;
> > > > > }
> > > > > }
> > > > >
> > > > > // return status
> > > > > return(nStatus);
> > > > > }
> > > > >
> > > > >
> > >
> > > ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail:
> > > xerces-c-dev-unsubscribe@xml.apache.org
> > > > > For additional commands, e-mail:
> > > xerces-c-dev-help@xml.apache.org
> > > > >
> > > >
> > > >
> > > >
> > >
> > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail:
> > > xerces-c-dev-unsubscribe@xml.apache.org
> > > > For additional commands, e-mail:
> > > xerces-c-dev-help@xml.apache.org
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > > xerces-c-dev-unsubscribe@xml.apache.org
> > > For additional commands, e-mail:
> > > xerces-c-dev-help@xml.apache.org
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail:
> > > xerces-c-dev-unsubscribe@xml.apache.org
> > > For additional commands, e-mail:
> > > xerces-c-dev-help@xml.apache.org
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> > > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> > > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> > > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> > > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> > For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>
>