XercesDOMParser parser_;
do
{
/*create a source file */
/*During the next iteration the following code will give runtime error*/
parser_.parse(source);
xercesc::DOMDocument* xmlDoc = parser_.getDocument() ;
/*How to release the memory allocated to the DOMDocument pointer*/
/*parse the file source*/
/*delete the source file*/
/*I used the function which you suggested*/
parser_.resetDocumentPool();
}while(dwbytes==bufsize);
/*some condition*/
On 2/27/08, Alberto Massari <[EMAIL PROTECTED]> wrote:
>
> Sree Harsha wrote:
> > Thanks Alberto,
> > I used resetDocumentPool(),
> > But I get a run time error R6025 pure virtual function call.
>
> When/where do you call resetDocumentPool? And where do you get the pure
> virtual function call? Are you attempting to access one of the DOM tree
> that you have just released?
>
> Alberto
>
> >
> > Thanks and regards
> > Sree Harsha Vardhana S.N
> >
> > On 2/27/08, *Alberto Massari* <[EMAIL PROTECTED]
> > <mailto:[EMAIL PROTECTED]>> wrote:
> >
> > Hi Sree,
> > you should invoke resetDocumentPool(), not reset(). As for the
> > code you
> > posted previously, I noticed you were not releasing the transcoded
> > strings (you actually commented the call to XMLString::release):
> that
> > would be a substantial leak.
> > On the other hand, if you want to parse files so big, you should
> > investigate switching to SAX parsing.
> >
> > Alberto
> >
> > Sree Harsha wrote:
> > > Thanks for your reply, but still the memory consumption has not
> come
> > > down. Is there any way i can reuse DOMDocument variable also like
> in
> > > the following snippet...
> > >
> > > do
> > > {
> > >
> > > /*create a source file */
> > >
> > > parser_.parse(source); //parser_ is a XercesDOMParser object
> > >
> > > xercesc::DOMDocument* xmlDoc = parser_.getDocument() ;
> > >
> > > /*How to release the memory allocated to the DOMDocument pointer*/
> > >
> > > /*parse the file source*/
> > >
> > > /*delete the source file*/
> > >
> > > /*I used the function which you suggested*/
> > >
> > > parser_.reset();
> > >
> > > /*still it takes up a lot of memory when parsing a big file*/
> > >
> > > }while(dwbytes==bufsize);
> > > /*some condition*/
> > >
> > > Finally I also have one more doubt... When we use DOM, the
> > entire file
> > > to be parsed is brought into the memory isnt it... Now if I have
> to
> > > parse a large file, say 380 MB or 1GB, we cant Bring the entire
> file
> > > to the memory. So I thought it would be better to split the file
> > into
> > > smaller sizes and parse them bit by bit (4K long)... that is the
> > > reason i have used create source file in the above code....
> > > Am I in the Right path????
> > >
> > > On 2/26/08, *Jesse Pelton* <[EMAIL PROTECTED] <mailto:[EMAIL
> > PROTECTED]>
> > <mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>>> wrote:
> > >
> > > It looks to me like you could call the various
> > > XercesDOMParser::reset...() and AbstractDOMParser::reset...()
> > > methods. Or, to be paranoid and/or lazy, you could use a new
> > > parser for each iteration.
> > >
> > >
> >
> ------------------------------------------------------------------------
> > > *From:* Sree Harsha [mailto:[EMAIL PROTECTED]
> > <mailto:[EMAIL PROTECTED]>
> > > <mailto:[EMAIL PROTECTED]
> > <mailto:[EMAIL PROTECTED]>>]
> > > *Sent:* Tuesday, February 26, 2008 5:40 AM
> > > *To:* [EMAIL PROTECTED]
> > <mailto:[EMAIL PROTECTED]> <mailto:[EMAIL PROTECTED]
> > <mailto:[EMAIL PROTECTED]>>;
> > > [email protected] <mailto:[email protected]>
> > <mailto:[email protected] <mailto:[email protected]>>
> > > *Subject:* Please help me out with this code..Can i reuse DOM
> > > objects in a while loop??????
> > >
> > >
> > > /*Can i reuse the DOM objects like XercesDOMParser object in a
> > > do... while loop as follows.... or will it cause any memory
> > leaks
> > > how to reuse them...*/
> > > do
> > > {
> > >
> > > /*create a source file */
> > >
> > > parser_.parse(source); //parser_ is a XercesDOMParser object
> > >
> > > /*parse the file source*/
> > >
> > > /*delete the source file*/
> > >
> > > /*what function should i call to reuse parser_ object in the
> > next
> > > iteration so that memory consumption reduces */
> > >
> > > }while(dwbytes==bufsize);
> > > /*some condition*/
> > >
> > >
> > > --
> > > Regards
> > > Sree Harsha Vardhana S.N
> > > "When you want something, all the universe conspires in
> > helping you to
> > > achieve it."
> > >
> > > --
> > > Regards
> > > Sree Harsha Vardhana S.N
> > > "When you want something, all the universe conspires in
> > helping you to
> > > achieve it."
> > >
> > >
> > >
> > >
> > > --
> > > Regards
> > > Sree Harsha Vardhana S.N
> > > "When you want something, all the universe conspires in helping
> > you to
> > > achieve it."
> >
> >
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > <mailto:[EMAIL PROTECTED]>
> >
> >
> >
> >
> > --
> > Regards
> > Sree Harsha Vardhana S.N
> > "When you want something, all the universe conspires in helping you to
> > achieve it."
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
--
Regards
Sree Harsha Vardhana S.N
"When you want something, all the universe conspires in helping you to
achieve it."