Re: [xml] xmlMemUsed() always returns 0 even when mem debug is activated
- From: Felip Manyé i Ballester <apaxeros gmail com>
- To: xml gnome org
- Subject: Re: [xml] xmlMemUsed() always returns 0 even when mem debug is activated
- Date: Thu, 25 Dec 2008 21:45:39 +0100
Thank your the answer. I know this was a borderline question, but my
main concern was whether xml2-config output was good or not, and
apparently it is. Anyway, I thank Daniel, Martin and you for answering
my questions. I now know that you need to call:
xmlMemSetup(xmlMemFree, xmlMemMalloc, xmlMemRealloc, xmlMemoryStrdup);
before using xmlMemUsed. Maybe this point could be precised in the
documentation ?
Regards,
Felip.
En/na Elvis Stansvik ha escrit:
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.
Regards,
Elvis
Regards,
Felip.
En/na Martin (gzlist) ha escrit:
On 18/12/2008, apaxeros gmail com <apaxeros gmail com> wrote:
Hello,
I've been trying to evaluate the amount of memory allocated using
xmlMemUsed. A similar question was asked in 2004:
http://mail.gnome.org/archives/xml/2004-March/msg00232.html,
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
--with-mem-debug.
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
calling:
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.
Martin
_______________________________________________
xml mailing list, project page http://xmlsoft.org/
xml gnome org
http://mail.gnome.org/mailman/listinfo/xml
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]