[gdome]more memory leaks



Hi,

I wanted to test if nodes that are not attached to the document (but
belong to a document, e.g. just created with Document::createElement) are
also deleted when the tree is freed; with the help of the memory debugging
tool that comes with the gnu C library. But I did not come so far, because
even the following simple program leaks memory:

--test.c----------
#include <gdome.h>
#include <mcheck.h>
int main() {
    GdomeDOMImplementation *di;
    GdomeDOMString       *name;
    GdomeDocument         *doc;
    GdomeException         exc = 0;

    mtrace(); /* start memory debugging */

    di   = gdome_di_mkref();
    name = gdome_str_mkref ("ex");

    /* comment out the following 2 lines to get rid of the memory leak */
    doc = gdome_di_createDocument(di, NULL, name, NULL, &exc);
    gdome_doc_unref(doc, &exc);
    /**/

    gdome_str_unref(name);
    gdome_di_unref(di, &exc);
    return 0;
}
-----------------------

to compile, run, and evaluate the memory trace I do the following
$ export MALLOC_TRACE=/tmp/mtrace
$ gcc -o test test.c -g `gdome-config --cflags --libs`
$ ./test

** WARNING **: GDOME-TREEGC: Free libxml2 DOM tree
$ mtrace ./test /tmp/mtrace
Memory not freed:
-----------------
   Address     Size     Caller
0x08049ac8     0x14  at 0x4007044f
0x08049ae0     0x1e  at 0x400703f9
0x08049b08     0x34  at 0x400703f9
0x08049b40    0x400  at 0x400703f9
0x08049fa0     0x1c  at 0x400703f9

As stated in the source, there is no memory leak when the calls to
gdome_di_createDocument and gdome_doc_unref are not performed.

Bye, Tobias




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]