xerces-c-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Lilley <jlil...@datalever.com>
Subject RE: method startElement() from class DOMLSParserFilter
Date Tue, 22 Sep 2009 18:50:54 GMT
Some suggestions...  if you do not require the DOM itself, you might use the SAX parser interface.
 It is not really much harder than the DOM interface although it takes some getting used to
the method-callback mechanism.  Alternatively, if it is OK to use the memory temporarily,
you could deep-copy the filtered DOM to a new DOM and discard the original.

john

-----Original Message-----
From: Alberto Massari [mailto:amassari@datadirect.com] 
Sent: Tuesday, September 22, 2009 12:41 PM
To: c-users@xerces.apache.org
Subject: Re: method startElement() from class DOMLSParserFilter

Hi Mirko,
sorry for the late answer; the DOM document is reusing that text 
fragment, but it doesn't try to use it for a similarly sized string. So, 
it gets reused immediately, maybe to store just a couple of characters 
(and that doesn't help reducing the memory footprint).

Alberto

Mirko Braun wrote:
> Hi Alberto,
>
> did you have the time to check "if node texts do the same 
> with the buffer used to keep the node value, and how they are recycled 
> (i.e. if the big buffer used by DATA nodes is reused for a much smaller 
> node)"?
>
> Mirko
>
> -------- Original-Nachricht --------
>   
>> Datum: Tue, 08 Sep 2009 09:37:52 +0200
>> Von: Alberto Massari <amassari@datadirect.com>
>> An: c-users@xerces.apache.org
>> Betreff: Re: method startElement() from class DOMLSParserFilter
>>     
>
>   
>> When you call release() on a node, the node is not deleted (as its 
>> memory comes from a pool that can be deleted as a whole) but it's placed 
>> in a "recycle bin" from where it is taken when a new node of the same 
>> type is requested. So, the next element will not allocate extra memory, 
>> but reuse that node. What I need to check is if node texts do the same 
>> with the buffer used to keep the node value, and how they are recycled 
>> (i.e. if the big buffer used by DATA nodes is reused for a much smaller 
>> node)
>>
>> Alberto
>>
>> Mirko Braun wrote:
>>     
>>> Sorry, I don't know how much memory is used. I just had a look at the
>>> maximum used memory in the task manager (Window XP). It doesn't
>>> matter if i used a DOMLSParserFilter or not the process DOMPrint.exe
>>>       
>> used the same size of memory.
>>     
>>> The XML-Elements DATA which i want to reject have very large values
>>> and i think if i reject these nodes they are also removed from
>>> memory. Does "be marked for recycling" mean, that these DATA nodes
>>> remain in memory?
>>>
>>> Mirko
>>>
>>> -------- Original-Nachricht --------
>>>   
>>>       
>>>> Datum: Mon, 07 Sep 2009 09:26:05 +0200
>>>> Von: Alberto Massari <amassari@datadirect.com>
>>>> An: c-users@xerces.apache.org
>>>> Betreff: Re: method startElement() from class DOMLSParserFilter
>>>>     
>>>>         
>>>   
>>>       
>>>> Mirko Braun wrote:
>>>>     
>>>>         
>>>>> Hi Alberto,
>>>>>
>>>>> thank you very much for your help. I integrated the patch in
>>>>> 3.0.1 and it worked. There is no exception any more.
>>>>> But there is still one problem. The usage of memory is still
>>>>> of the same size. I think if a node is rejected from the tree
>>>>> the usage of memory should also decrease. Is my conclusion
>>>>> correct?
>>>>>   
>>>>>       
>>>>>           
>>>> Yes, if a node is rejected is should be marked for recycling; how much 
>>>> memory are you seeing is been used?
>>>>
>>>> Alberto
>>>>         


Mime
View raw message