[xsd-users] XSD uses a lot of memory

Maxim Maslennikov maxim.maslennikov at gmail.com
Sun Mar 8 10:20:22 EDT 2015


Hi Boris,

I meant my program uses an "object persistance" approach described in your document - "XML Parsing and Serialization in C++
With libstudxml” and also saves all data in memory.
So my question is why does xsd C++/tree use about ten time more memory?
I found it when generated a file of records about 100Mb size.

Best Regards,
Maxim Maslennikov

> On Mar 3, 2015, at 2:12 PM, Boris Kolpackov <boris at codesynthesis.com> wrote:
> 
> Hi Maxim,
> 
> Maxim Maslennikov <maxim.maslennikov at gmail.com> writes:
> 
>> I created a program of xml data binding test.xsd schema from example
>> folder based on xsd C++/tree and libstudxml persistence. I tested xsd
>> on OS X and FreeBSD and was surprised xsd version uses in ten time
>> more memory than libstudxml version.
>> 
>> Why does xsd/c++ tree uses memory more?
> 
> Because C++/Tree is an in-memory mapping. It loads all the data from
> the XML document into memory. In contrast, libstudxml is a streaming
> parser, it only keeps a very small portion of the document at any
> given time (unless you store this data yourself somewhere).
> 
> 
>> Is it possible to improve it?
> 
> Yes, you can use streaming parser with C++/Tree. See the 'streaming'
> example.
> 
> Boris



More information about the xsd-users mailing list