Thread: libxml++ memory usage

  1. #1
    Registered User
    Join Date
    Mar 2010

    libxml++ memory usage

    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!

  2. #2
    Registered User jeffcobb's Avatar
    Join Date
    Dec 2009
    Henderson, NV
    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...
    Last edited by jeffcobb; 03-19-2010 at 12:48 PM. Reason: Spelling; what I get for posting pre-caffeination..
    C/C++ Environment: GNU CC/Emacs
    Make system: CMake
    Debuggers: Valgrind/GDB

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    > or is this problem known for 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.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    Registered User
    Join Date
    Mar 2010
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

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