Actions
Bug #6398
closedBug #6392: Memory leak in PySaxonProcessor (Python)
Another? memory leak when using XSLT
Start date:
2024-04-16
Due date:
% Done:
0%
Estimated time:
Applies to branch:
Fix Committed on Branch:
12
Fixed in Maintenance Release:
Found in version:
Fixed in version:
12.5
SaxonC Languages:
SaxonC Platforms:
SaxonC Architecture:
Description
Here is test case compiling a single stylesheet once and running it various times in a loop, that approach also shows a memory leak:
from saxonche import PySaxonProcessor import psutil
xslt = """<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="3.0" expand-text="yes">
<xsl:template name="xsl:initial-template"> <xsl:for-each select="random-number-generator(current-dateTime())?permute(1 to 20)"> Item {.} </xsl:for-each> </xsl:template>
</xsl:stylesheet>"""
count = 0 process = psutil.Process() prev = process.memory_info().rss print(f"{prev:,}") print()
with PySaxonProcessor() as proc:
xslt_processor = proc.new_xslt30_processor()
xslt_executable = xslt_processor.compile_stylesheet(stylesheet_text=xslt)
for _ in range(100):
xslt_executable.call_template_returning_value()
if (count := count + 1) % 10 == 0:
m = process.memory_info().rss
print(f"{m - prev:,}")
prev = m
print() print(f"{prev:,}")
Please register to edit this issue
Actions