Re: JDOM parser reuse memory problem

Randall Theobald <[email protected]>
Newsgroups gmane.comp.java.jdom.general
Message-ID <OF8BDB08C0.56FD876B-ON86257945.00449425-86257945.0044D08C@us.ibm.com>
I'd vote for a proper fix of properly resetting the XMLReader at the end of
the build method. Our product is stuck on 1.0-beta-7 or something which
doesn't even have the parser reuse in it yet, so there is no hurry. I just
wanted to make sure that the issue got looked at moving forward.
                                                      
   Randall Theobald                                   
                                                      
   Performance: WebSphere                             
   Business Process                                   
   Management &                                       
   Connectivity                                       
                                                      
   IBM Software Group             [email protected] 
                                                      
   Austin, TX                     512-286-8870   t/l: 
                                             363-8870 
                                                      
                                                      
                                                      







From:	Rolf Lear <[email protected]>
To:	Michael Kay <[email protected]>,
Cc:	[email protected]
Date:	11/11/2011 05:31 AM
Subject:	Re: [jdom-interest] JDOM parser reuse memory problem
Sent by:	[email protected]



On 11/11/2011 3:33 AM, Michael Kay wrote:
> On 10/11/2011 18:51, Rolf Lear wrote:
>> Hi Randall, Michael.
>>
>> It's an interesting observation... and I can see the implications. I
>> would
>> like to take a closer look at at, but that may take a little while.
>>
>> I filed https://github.com/hunterhacker/jdom/issues/52
>>
>> 'Off the cuff' I can think of one work-around and a few solutions (in
>> addition to what Michael has suggested)
>>
>> 1. immediately after parsing your real document you then parse a
>> dummy/small/inmemory document (even invalid - and catch the exception).
>> 2. Currently when you do-no reuse the parser, it goes back to 'first
>> principals' and queries JAXP, etc. to find a parser instance Instead it
>> could 'cache' the parser 'source' after the first time, and then just
>> create a new instance, instead of doing all the class-based lookups...
>
> Ouch. Creating a new parser to parse a small document is a cost that
> it's nice to avoid, but it isn't going to kill you. Going through the
> JAXP factory process to get a new ParserFactory is a monstrous cost
> that can dominate all other processing - and reusing the factory costs
> nothing.
>
> Michael Kay
> Saxonica
>
Not sure what you are saying... are you agreeing that the 'ouch' problem
is the one it has at the moment, or the suggestion to skip the JAXB
processing on subsequent non-reuse-parser parses?

I have not yet had a close look at the problem... the potential option
of not going back to first-principles on subsequent parses may not be
(easily) possible.... Unless Randall can convince me otherwise, I'm
going to finish working on some StAX outputter code I am embroiled in,
and then look at it.

Rolf
_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/[email protected]



_______________________________________________
To control your jdom-interest membership:
http://www.jdom.org/mailman/options/jdom-interest/[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.