3 Nov 2011 11:36
Re: Memory leak when parsing XML files in sequence?
Maarten van Gompel (proycon <proycon <at> anaproy.nl>
2011-11-03 10:36:17 GMT
2011-11-03 10:36:17 GMT
Hi,
> Christian Heimes, 30.10.2011 14:58:
>> I did some additional debugging with valgrind and found the code segment
>> that causes the memory leak. Well, it's not a real memory leak but a
>> feature. ;)
>> It's in libxml2's SAX2.c in the function xmlSAX2StartElementNs():>>
>> * when validating, the ID registration is done at the attribute
>> * validation level. Otherwise we have to do specific handling here.
>> */
>> if (xmlStrEqual(fullname, BAD_CAST "xml:id")) {
>> /*
>> * Add the xml:id value
>> *
>> * Open issue: normalization of the value.
>> */
>> if (xmlValidateNCName(value, 1) != 0) {
>> xmlErrValid(ctxt, XML_DTD_XMLID_VALUE,
>> "xml:id : attribute value %s is not an NCName\n",
>> (const char *) value, NULL);
>> }
>> xmlAddID(&ctxt->vctxt, ctxt->myDoc, value, ret);
>> } else if (xmlIsID(ctxt->myDoc, ctxt->node, ret))
>> xmlAddID(&ctxt->vctxt, ctxt->myDoc, value, ret);
>> else if (xmlIsRef(ctxt->myDoc, ctxt->node, ret))
>> xmlAddRef(&ctxt->vctxt, ctxt->myDoc, value, ret);
>> }
>>
>>
(Continue reading)
RSS Feed