[xml] Strange memory leak in libxml2-2.4.8 (may be in libxslt-1.0.6)



Hello, ! How are you?

  I found very strange memory leak in last libxml2.
  Here is description of situation:

  When I parse and free some documents in simple program, like:

  for(i=0;i<100;i++) {
     doc = xmlParseFile("empty.xml");
     xmlFreeDoc(xsltApplyStylesheet(style,doc,NULL));
     xmlFreeDoc(doc);
  }

  First pair of calls xmlParseFile()/xmlFreeDoc() leaves some allocated memory (42 calls to
  malloc(), 6185 bytes of memory for me).
  All other calls are balanced.
  Ok, I think, it is some internal buffers, and it is NOT memory leak.

  But in very complex program such memory leak occurs on EVERY pair of
  xmlParseFile()/xmlFreeDoc() calls!

  In my big program I parse some documents, make transofrmation, then
  free some of them, then set options of xmllib2 via
  xmlSetGenericErrorFunc() and  xmlSubstituteEntitiesDefault() then
  parse new documents, etc. And every xmlParseFile()/xmlFreeDoc() pair
  is not balanced in such situation! And I have memory leak about 7000
  bytes on every parsed document! It was caught by my wrappers around
   malloc()/free()/strdup()/realloc().

  I could not reproduce this situation in simple program.
  Is it my fault or library bug?
  I think, some of my code between document loading re-init libxml2
  library, and it `thinks', that it needs new buffers or something
  like this.

  Which my actions could trigger such odd behavior?!

  

               Lev Serebryakov
/-----------------------------------------------\
| FIDONet: 2:5030/661.0                         |
| E-Mail:  lev serebryakov spb ru               | 
| Page:    http://lev.serebryakov.spb.ru/       |
| ICQ UIN: 3670018                              |
| Phone:   You know, if you have world nodelist |
\===============================================/




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