Project

Profile

Help

Bug #6397

open

Another? memory leak when using XPath

Added by Martin Honnen 13 days ago.

Status:
New
Priority:
Normal
Category:
Python API
Start date:
2024-04-16
Due date:
% Done:

0%

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

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

No data to display

Please register to edit this issue

Also available in: Atom PDF