Project

Profile

Help

Bug #6397

closed

Bug #6392: Memory leak in PySaxonProcessor (Python)

Another? memory leak when using XPath

Added by Martin Honnen 8 months ago. Updated 5 months ago.

Status:
Closed
Priority:
Normal
Category:
Python API
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:
12.4.2
Fixed in version:
12.5
SaxonC Languages:
SaxonC Platforms:
SaxonC Architecture:

Description

Here is a pure XPath evaluation also showing a memory leak:

from saxonche import PySaxonProcessor
import psutil

xpath = "random-number-generator(current-dateTime())?permute(1 to 20)"

count = 0
process = psutil.Process()
prev = process.memory_info().rss
print(f"{prev:,}")
print()

with PySaxonProcessor() as proc:

    xpath_processor = proc.new_xpath_processor()

    for _ in range(100):

        xpath_processor.evaluate(xpath)

        if (count := count + 1) % 10 == 0:
            m = process.memory_info().rss
            print(f"{m - prev:,}")
            prev = m

print()
print(f"{prev:,}")

Windows shows

26,116,096

3,866,624
507,904
491,520
499,712
495,616
499,712
495,616
499,712
495,616
499,712

34,467,840

Linux shows

32,849,920

7,581,696
270,336
540,672
540,672
540,672
540,672
540,672
540,672
270,336
540,672

44,756,992

Please register to edit this issue

Also available in: Atom PDF