-
libxml++ memory usage
Hello,
while opening a ~50MB file, libxml++ used ~1.5GB RAM, which I find somewhat excessive. Is this an error in my usage (i.e., did I forget to set some hidden "don't waste memory"-flag?) or is this problem known for libxml++? If so, can you recommend another portable (Linux, BSD, Windows) xml parser?
Thanks in advance!
-
Well one really tiny library that I use a lot and love for the simplicity as well as how much control you get over how much "library" you end up with is TinyXml Main Page.
Tiny XML has hooks for C and C++, is (or was last time I downloaded it) only 5 small source files in size and is easy to use/get up to speed with. It is non-validating, be warned but sometimes you don't care and just want a quick and dirty XML parser/generator. Best of all it works on all platforms.
As for the memory usage it is probably all of the trees that get built when most parsers tear into a file. 50mb seems a little heavy for XML but you must have your reasons...I think the largest I ever did was about 20mb but that was mostly binary data...
-
> or is this problem known for libxml++?
libxml++
Maybe there is a bug filed already.
On which OS did you do your test, and how did you determine how much memory was used?
Have you tried smaller XML files - do your results scale?
For a list of parsers
XML Parsers
-
Thanks for your fast replies. I'll have a look at Tiny xml.
I don't really need xml, but I like the format for its extensibility and readability (plus, it is known by about everyone dealing with those computer thingies). I use it for big graphs (>10^7 edges). Memory usage was estimated on a Debian system with a Linux 2.6 kernel, with "top" (so it isn't accurate at all), but when reading a simple edge list via ifstream, memory usage decreased by 1.5 GB (and the process didn't say good-by via SIGTERM for the 60MB file...). Memory usage seems to be linearly dependent on file size.
Anyways, thanks again for your help.