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:

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 --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 Veillard      | libxml Gnome XML XSLT toolkit
daniel veillard com  | Rpmfind RPM search engine | virtualization library

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