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



On Thu, Dec 18, 2008 at 03:29:55PM +0100, 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.
Unfortunately, the following code:

 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);

always returns "Used memory: 0", while xmlDocDump() generates a correct
output. Is there a special way of using this function ?

  make 100% sure you link with the newly recompiled library,
if needed run under gdb and put a breakpoint on xmlMallocLoc.

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/



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