[Mono-dev] XmlDocument.ReadNode() causes huge memory consumpsion by XmlTextReader

Sasha Kogan sashak at mainsoft.com
Wed Nov 5 08:03:07 EST 2008


10x, it solves the issue.

/Sasha

-----Original Message-----
From: Atsushi Eno [mailto:atsushi at ximian.com] 
Sent: Tuesday, November 04, 2008 8:28 AM
To: Sasha Kogan
Cc: mono-devel-list at lists.ximian.com
Subject: Re: [Mono-dev] XmlDocument.ReadNode() causes huge memory
consumpsion by XmlTextReader

I think it is fixed at r117838 Can you try it and see if it's gone?

Thanks,
Atsushi Eno

Atsushi Eno wrote:
> Hello,
> 
> Thanks Sasha, I'll have a look. It looks like only about
XmlTextReader,
> and once I find the culprit it wouldn't be hard to fix.
> 
> Atsushi Eno
> 
> 
> Sasha Kogan wrote:
>> Hi,
>> I get OutOfMemoryError (I use Grasshopper, but the problem is not
>> Java-specific) when running the following code:
>>
>> void runTest(string filename)
>> {
>>     XmlDocument doc = new XmlDocument();
>>     XmlReader xmlReader = XmlReader.Create(filename);
>>
>>     while (!xmlReader.EOF)
>>     {
>> 	if ((xmlReader.NodeType == XmlNodeType.Element) &&
>> (xmlReader.Depth == 1))
>> 	    doc.ReadNode(xmlReader);
>> 	else
>> 	    xmlReader.Read();
>>     }
>> }
>>
>> on a large (let's say, ~0.5GB) xml structured like this:
>>
>> <RootElem>
>>    <Elem TestAttrib="Some text some text some text"/>
>>    ...
>>    ...
>>    <Elem TestAttrib="Some text some text some text"/>
>> </RootElem>
>>
>>
>>
>> I can see that XmlTextReader.ClearValueBuffer() is never called in
this
>> case, so the attribute values of all processed elements are
accumulated
>> in XmlTextReader.valueBuffer.
>>
>> Would it be difficult to fix?
>>
>> TIA,
>>
>>
>> /Sasha
>> _______________________________________________
>> Mono-devel-list mailing list
>> Mono-devel-list at lists.ximian.com
>> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>>
> 
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
> 



More information about the Mono-devel-list mailing list