[xml] xmlFreeDoc not freeing on AIX?



The attached program does nothing more than parse a document, free it,
and call the cleanup parser function.

On linux when using it to parse a 50K xml file I see the following using
ps -v

RSS memory before the first parse:  604
RSS memory after the first parse : 1332
RSS memory after the first free  :  952

Then the parse and free cycles between 1332 and 952 quite predictably.

On AIX the results for the same file look like this:

RSS memory before the first parse:  540
RSS memory after the first parse : 1024
RSS memory after the first free  : 1024

My question is whether I have a leak here and I'm missing something in
the xml library. Do I need to add some more function calls to clean up
after my parsing? Or is this really just a side effect of having two
different kernels with two different allocation strategies. 

I plan on having a long running shared library parsing many different
documents over time and want to be sure I don't hog resources that I
don't have to.

Thanks,
Andrew Smith

-----8<----simpleparse.c------8<------
/* key presses allow for running ps before and after parsing */
#include <stdio.h>

#include "libxml/xpath.h"

void main(int argc, char *argv[]) {
  char key[1];
  xmlDocPtr doc;  
  while(1) {
    printf("press any key to parse:");
    scanf("%c", key);
    doc = xmlParseFile(argv[1]);
    printf("press any key to free:");
    scanf("%c", key);
    xmlFreeDoc(doc); 
    xmlCleanupParser();
  }
}





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