Project

Profile

Help

Bug #6397

closed

Bug #6392: Memory leak in PySaxonProcessor (Python)

Another? memory leak when using XPath

Added by Martin Honnen 3 months ago. Updated 14 days 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
Actions #1

Updated by Naim Malek 2 months ago

Martin Honnen wrote:

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

It's the same issue I am getting.

Actions #2

Updated by Naim Malek 2 months ago

.

Actions #3

Updated by Matt Patterson about 1 month ago

  • Status changed from New to Resolved
  • Parent issue set to #6392
  • Fixed in version set to 12.5.0

Whether it was identical to #6392 or not, it was resolved at the same time and I'm marking it as a child issue. See #6392 for more details...

Actions #4

Updated by O'Neil Delpratt 14 days ago

  • Status changed from Resolved to Closed
  • Fixed in version changed from 12.5.0 to 12.5

Bug fix applied in the Saxon 12.5 Maintenance release.

Actions #5

Updated by Community Admin 14 days ago

  • Fix Committed on Branch 12 added

Please register to edit this issue

Also available in: Atom PDF