Re: [xml] xmlMemUsed() always returns 0 even when mem debug is activated

2008/12/20 Felip Manyé i Ballester <apaxeros gmail com>:
Thanks a lot for your answer Martin, when I call xmlMemSetup(), xmlMemUsed()
works with Debian and Ubuntu packages ! I had not understood its use before.

I still don't know why my binary links with the system-wide dynamic library
and not the one I compiled, even though I explicitly invoke the good
xml2-config in my makefile (see previous message). Has anybody got an idea ?

Probably because your dynamic linker looked in /usr/lib first. If
you're on a Linux system, use the LD_LIBRARY_PATH environment variable
to specify the path to the libraries, or use the -rpath linker option
(not recommended).

Anyway, this is not a libxml2 question, but a question about how
dynamic linking works, which you can read up on Wikipedia and in the
manual for your compiler/OS.




En/na Martin (gzlist) ha escrit:

On 18/12/2008, apaxeros gmail com <apaxeros gmail com> wrote:


I've been trying to evaluate the amount of memory allocated using
xmlMemUsed. A similar question was asked in 2004:,
and Daniel replied that mem debug had to be activated. That's why I
recompiled libxml2 (version 2.6.30, on Ubuntu 8.04) with the option

On my Debian box at least, the system libxml2 is already compiled with
that option, you just need to activate the debug malloc stuff by

    xmlMemSetup(xmlMemFree, xmlMemMalloc, xmlMemRealloc, xmlMemoryStrdup);

prior to doing any of this:

 doc = xmlParseFile(argv[2]);
  if (doc == NULL)
      printf ("%s could not be parsed\n", argv[2]);
      exit (1);
  printf("Used memory: %d\n", xmlMemUsed());
  xmlDocDump(stdout, doc);

Perhaps I misunderstand, or Ubuntu fiddled with the package.


xml mailing list, project page
xml gnome org

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