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



Hello, Daniel!
Thursday, November 08, 2001, 11:28:40 PM, you wrote:

DV>   Read and follow the instructions:
DV>     http://xmlsoft.org/xmlmem.html#Debugging

  Here is SIMPLEST program:
==================================================
#include <libxml/parser.h>
#include <libxml/parserInternals.h>

int main(int argn, char *argv[])
{
    xmlDocPtr doc;

    xmlInitMemory();
    doc = xmlParseFile("empty.xml");
    xmlFreeDoc(doc);
    xmlMemoryDump();
}
==================================================

XML:
==================================================
<?xml version="1.0" encoding="koi8-r"?>
<?xml-stylesheet href="style/empty.xsl" media="text/html" type="text/xsl"?>
<page></page>
==================================================


And here is .memdump:
==================================================
      MEMORY ALLOCATED : 6017, MAX was 18963
BLOCK  NUMBER   SIZE  TYPE
0          42      4 malloc()  in none(0) "amp"
1          41     20 malloc()  in none(0) pointer to #42 at index 4
2          40      2 malloc()  in none(0) "&"
3          39      4 malloc()  in none(0) "amp"
4          38     68 malloc()  in none(0) pointer to #39 at index 8
5          37      5 malloc()  in none(0) "quot"
6          36     20 malloc()  in none(0) pointer to #37 at index 4
7          35      2 malloc()  in none(0) """
8          34      5 malloc()  in none(0) "quot"
9          33     68 malloc()  in none(0) pointer to #34 at index 8
10         32      5 malloc()  in none(0) "apos"
11         31     20 malloc()  in none(0) pointer to #32 at index 4
12         30      2 malloc()  in none(0) "'"
13         29      5 malloc()  in none(0) "apos"
14         28     68 malloc()  in none(0) pointer to #29 at index 8
15         27      3 malloc()  in none(0) "gt"
16         26     20 malloc()  in none(0) pointer to #27 at index 4
17         25      2 malloc()  in none(0) ">"
18         24      3 malloc()  in none(0) "gt"
19         23     68 malloc()  in none(0) pointer to #24 at index 8
20         22      3 malloc()  in none(0) "lt"
21         21     20 malloc()  in none(0) pointer to #22 at index 4
22         20      2 malloc()  in none(0) "<"
23         19      3 malloc()  in none(0) "lt"
24         18     68 malloc()  in none(0) pointer to #19 at index 8
25         17   5120 malloc()  in none(0) pointer to #36 at index 28
26         16     12 malloc()  in none(0) pointer to #17 at index 0
27         15     20 malloc()  in none(0) pointer to #14 at index 0
28         14      5 strdup()  in none(0) "HTML"
29         13     20 malloc()  in none(0) pointer to #12 at index 0
30         12      9 strdup()  in none(0) "US-ASCII"
31         11     20 malloc()  in none(0) pointer to #10 at index 0
32         10      6 strdup()  in none(0) "ASCII"
33          9     20 malloc()  in none(0) pointer to #8 at index 0
34          8     11 strdup()  in none(0) "ISO-8859-1"
35          7     20 malloc()  in none(0) pointer to #6 at index 0
36          6      9 strdup()  in none(0) "UTF-16BE"
37          5     20 malloc()  in none(0) pointer to #4 at index 0
38          4      9 strdup()  in none(0) "UTF-16LE"
39          3     20 malloc()  in none(0) pointer to #2 at index 0
40          2      6 strdup()  in none(0) "UTF-8"
41          1    200 malloc()  in none(0) pointer to #3 at index 0
==================================================

  6017 bytes of memory leak. And in complex program I have such memory
  leak for EACH parsed/freed document! But I could not reproduce it in
  sample code.

  It seems, xmlInitParser() and xmlCleanupParser() will help me.
  I'll try them soon.

                                  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]