C Board  

Go Back   C Board > General Programming Boards > C++ Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 03-19-2010, 09:09 AM   #1
Registered User
 
Join Date: Mar 2010
Posts: 18
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!
assertion is offline   Reply With Quote
Old 03-19-2010, 09:40 AM   #2
Registered User
 
jeffcobb's Avatar
 
Join Date: Dec 2009
Location: Henderson, NV
Posts: 887
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...
__________________
C/C++ Environment: GNU CC/Emacs
Make system: CMake
Debuggers: Valgrind/GDB

Last edited by jeffcobb; 03-19-2010 at 12:48 PM. Reason: Spelling; what I get for posting pre-caffeination..
jeffcobb is offline   Reply With Quote
Old 03-19-2010, 09:45 AM   #3
and the hat of Destiny
 
Salem's Avatar
 
Join Date: Aug 2001
Location: The edge of the known universe
Posts: 22,495
> 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
__________________
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.

Salem is offline   Reply With Quote
Old 03-19-2010, 10:36 AM   #4
Registered User
 
Join Date: Mar 2010
Posts: 18
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.
assertion is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
tools for finding memory leaks stanlvw C++ Programming 4 04-03-2009 11:41 AM
Problems with shared memory shmdt() shmctl() Jcarroll C Programming 1 03-17-2009 10:48 PM
how much memory usage for my program? elninio Linux Programming 4 08-01-2008 03:58 PM
Structs vs. Classes, Memory Usage CrazyNorman Game Programming 2 07-17-2005 05:43 PM
Memory Usage ghe1 Linux Programming 0 03-18-2002 09:43 AM


All times are GMT -6. The time now is 12:10 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22