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



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 ?

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

  


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