[xml] too many mallocs?



Daniel, All,

In the process of better understanding the inner
workings of libxml2, and noting that simple parsing
is bound by malloc in my tests, I came across
following factoid:

Going from the input file

<foo><bar><xxx>XXXXXX</xxx><yyy>YYYYY</yyy></bar></foo>

to

<foo><bar><xxx>XXXXXX</xxx><yyy>YYYYY</yyy></bar><bar><xxx>XXXXXX</xxx><yyy>YYYYY</yyy></bar></foo>

The number of mallocs used by libxml2 raises by 44 (from 120 to 164).
This seems a bit wasted for two new start tags, two new end tags and
two new char nodes.

And there are 37 mallocs of size 3944 in case 1, compared with
62 mallocs of size 3900 in case 2, most likely from xmlInputBufferGrow.

Is something broken with my libxml2? I compiled 2.4.21 with 
all features off. (Using Watcom C 11.0b under WNT4.0).

Is gcc's malloc such a fine piece of art, that you don't see
negative effects from these large number of mallocs?



Regards,
Peter Jacobi



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