After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 707418 - Python libxml2/ libxslt append unlinkedNode to new xmldoc from transformed result produces memory-leak
Python libxml2/ libxslt append unlinkedNode to new xmldoc from transformed re...
Status: RESOLVED OBSOLETE
Product: libxml2
Classification: Platform
Component: python
2.7.8
Other Linux
: Normal major
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2013-09-03 20:34 UTC by xcode986
Modified: 2021-07-05 13:21 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description xcode986 2013-09-03 20:34:47 UTC
When running current python code, i get a memory-leak.
The xmldoc result seems to be corrupt or not compatible with new xmldocs after transformation.
This is problematicaly, because there are no way to join multiple transformed xmldocs without copying the nodes or reparse xmldocs. The libxml2 and libxslt binding are perfect for multiple transformations and join operations, because libxslt accept an xmldoc for transformation and also returns one which makes processing really fast. But with this bug this is an real performance show-stopper. Same bug was observed in the Perl-Bindings which is a hint that the bug must be in the c-library. I also tried to transform the doc which an transform_ctxt and the libxml2.XML_PARSE_NODICT option, but without success.

import libxml2
import libxslt

# XSLT Transform
doc = libxml2.parseDoc("""
<result>
	<result>abc</result>
	<result>def</result>
</result>
""")
styledoc = libxml2.parseDoc("""
<xsl:stylesheet version='1.0'
  xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>

  <xsl:template match='/'>
  	<xsl:copy-of select="*"/>
  </xsl:template>
</xsl:stylesheet>
""")
xsl_transform = libxslt.parseStylesheetDoc(styledoc)
xml_result_doc = xsl_transform.applyStylesheet(doc, {})    
xsl_transform.freeStylesheet()
doc.freeDoc()

# Unlink Node from XSLT-Transformed result
xml_result_root = xml_result_doc.getRootElement()
xml_result_root.unlinkNode()
xml_result_root.setTreeDoc(None)
xml_result_root.freeNode()
xml_result_doc.freeDoc()
Comment 1 GNOME Infrastructure Team 2021-07-05 13:21:57 UTC
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org.
As part of that, we are mass-closing older open tickets in bugzilla.gnome.org
which have not seen updates for a longer time (resources are unfortunately
quite limited so not every ticket can get handled).

If you can still reproduce the situation described in this ticket in a recent
and supported software version, then please follow
  https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines
and create a new ticket at
  https://gitlab.gnome.org/GNOME/libxml2/-/issues/

Thank you for your understanding and your help.