Project

Profile

Help

Bug #6398

open

Another? memory leak when using XSLT

Added by Martin Honnen about 1 month ago. Updated about 1 month ago.

Status:
New
Priority:
Low
Category:
-
Start date:
2024-04-16
Due date:
% Done:

0%

Estimated time:
Found in version:
Fixed in version:
Platforms:

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

Also available in: Atom PDF