SAP / PyRFC

Asynchronous, non-blocking SAP NW RFC SDK bindings for Python
http://sap.github.io/PyRFC
Apache License 2.0
515 stars 141 forks source link

Memory Leak in Connection() #298

Closed mpf82 closed 1 year ago

mpf82 commented 1 year ago

Describe the bug There is a memory leak in Connection()

To Reproduce Creating and closing connections will leak memory, full test app code at the end of the issue.

Environment

Additional context On some customer systems we cannot use a single connection for the life tim of the application, thus we're creating a new connection for each RFC call. Because of this, we've noticed an increase in memory usage for our process and tracked it down to the pyrfc.Connection() call.


import time
import os
import psutil
import test_pyrfc_conn_data as cd

os.environ[ 'SAPNWRFC_HOME' ] = cd.SAPNWRFC_HOME_NT

from pyrfc import Connection

pid      = os.getpid()
process  = psutil.Process( pid )
rss_init = None     # process.memory_info().rss
count    = 0

def connect():
    return Connection( user=cd.USER, passwd=cd.PASSWD, ashost=cd.ASHOST, sysnr=cd.SYSNR, client=cd.CLIENT )

def mem_diff():
    global rss_init
    rss = process.memory_info().rss
    if rss_init is None:
        rss_init = rss
        print( f"rss_init: {rss_init}" )
    diff = rss - rss_init
    perc = ( diff / rss_init ) * 100
    print( f"count: {count} | rss: {rss} | diff: {diff} | diff/count: {round(diff/count)} | change: {round(perc, 2)}%" )

while 1:
    count += 1
    cnxn   = connect()
    cnxn.close()
    if not ( count % 10 ):
        time.sleep( 3 )
        mem_diff()

Excerpt from our output:

rss_init: 34996224 count: 10 | rss: 34996224 | diff: 0 | diff/count: 0 | change: 0.0% count: 20 | rss: 35033088 | diff: 36864 | diff/count: 1843 | change: 0.11% count: 30 | rss: 35057664 | diff: 61440 | diff/count: 2048 | change: 0.18% count: 40 | rss: 35082240 | diff: 86016 | diff/count: 2150 | change: 0.25% count: 50 | rss: 35102720 | diff: 106496 | diff/count: 2130 | change: 0.3% count: 60 | rss: 35119104 | diff: 122880 | diff/count: 2048 | change: 0.35% count: 70 | rss: 35123200 | diff: 126976 | diff/count: 1814 | change: 0.36% count: 80 | rss: 35123200 | diff: 126976 | diff/count: 1587 | change: 0.36% count: 90 | rss: 35123200 | diff: 126976 | diff/count: 1411 | change: 0.36% count: 100 | rss: 35123200 | diff: 126976 | diff/count: 1270 | change: 0.36% ... count: 200 | rss: 35217408 | diff: 221184 | diff/count: 1106 | change: 0.63% count: 300 | rss: 35233792 | diff: 237568 | diff/count: 792 | change: 0.68% count: 400 | rss: 35241984 | diff: 245760 | diff/count: 614 | change: 0.7% count: 500 | rss: 35303424 | diff: 307200 | diff/count: 614 | change: 0.88% count: 600 | rss: 35438592 | diff: 442368 | diff/count: 737 | change: 1.26% count: 700 | rss: 35422208 | diff: 425984 | diff/count: 609 | change: 1.22% count: 800 | rss: 35487744 | diff: 491520 | diff/count: 614 | change: 1.4% count: 900 | rss: 35561472 | diff: 565248 | diff/count: 628 | change: 1.62% count: 1000 | rss: 35565568 | diff: 569344 | diff/count: 569 | change: 1.63% count: 1250 | rss: 35688448 | diff: 692224 | diff/count: 554 | change: 1.98% count: 1500 | rss: 35840000 | diff: 843776 | diff/count: 563 | change: 2.41% count: 1750 | rss: 35856384 | diff: 860160 | diff/count: 492 | change: 2.46% count: 2000 | rss: 36040704 | diff: 1044480 | diff/count: 522 | change: 2.98% count: 2250 | rss: 36200448 | diff: 1204224 | diff/count: 535 | change: 3.44% count: 2500 | rss: 36315136 | diff: 1318912 | diff/count: 528 | change: 3.77% ...


From psutil docs:

rss: aka “Resident Set Size”, this is the non-swapped physical memory a process has used. On UNIX it matches “top“‘s RES column). On Windows this is an alias for wset field and it matches “Mem Usage” column of taskmgr.exe.

mpf82 commented 1 year ago

The same can be seem when changing the loop to re-use the same connection with reopen:

cnxn = connect()
while 1:
    count += 1
    cnxn.reopen()
    if not ( count % 10 ):
        time.sleep( 3 )
        mem_diff()
mpf82 commented 1 year ago

@bsrdjan Please let me know if you need further information.

bsrdjan commented 1 year ago

Hello @mpf82,

I could not reproduce by testing on Ubuntu 20.04.5 LTS (docker), with RFC SDK 7.5.10 and with Python 3.9 and 3.11

Here the test script

import os
import sys
import time
import psutil

from pyrfc import Connection, __version__, get_nwrfclib_version

print (sys.version)
print (__version__, get_nwrfclib_version())

pid = os.getpid()
process = psutil.Process(pid)
rss_init = None  # process.memory_info().rss
count = 0

def connect():
    return Connection(dest="QM7")

def mem_diff():
    global rss_init
    rss = process.memory_info().rss
    if rss_init is None:
        rss_init = rss
        print(f"rss_init: {rss_init}")
    diff = rss - rss_init
    perc = (diff / rss_init) * 100
    print(f"count: {count} | rss: {rss} | diff: {diff} | diff/count: {round(diff/count)} | change: {round(perc, 2)}%")

while 1:
    count += 1
    cnxn = connect()
    assert cnxn.alive == True
    cnxn.close()
    if not (count % 10):
        time.sleep(3)
        mem_diff()

and output with python 3.9.16

(py3.9.16) $ python ci/issues/i298.py 
rss_init: 68435968
count: 10 | rss: 68435968 | diff: 0 | diff/count: 0 | change: 0.0%
count: 20 | rss: 68726784 | diff: 290816 | diff/count: 14541 | change: 0.42%
count: 30 | rss: 68726784 | diff: 290816 | diff/count: 9694 | change: 0.42%
count: 40 | rss: 68726784 | diff: 290816 | diff/count: 7270 | change: 0.42%
count: 50 | rss: 68726784 | diff: 290816 | diff/count: 5816 | change: 0.42%
count: 60 | rss: 68726784 | diff: 290816 | diff/count: 4847 | change: 0.42%
count: 70 | rss: 68726784 | diff: 290816 | diff/count: 4155 | change: 0.42%

Some memory is allocated after 1st cycle (after 1st open/call probably) and no increase after that.

With python 3.11.1 there was no even that "initial" increase

(py3.11.1) $ python ci/issues/i298.py 
rss_init: 73166848
count: 10 | rss: 73166848 | diff: 0 | diff/count: 0 | change: 0.0%
count: 20 | rss: 73166848 | diff: 0 | diff/count: 0 | change: 0.0%
count: 30 | rss: 73166848 | diff: 0 | diff/count: 0 | change: 0.0%
count: 40 | rss: 73166848 | diff: 0 | diff/count: 0 | change: 0.0%
count: 50 | rss: 73166848 | diff: 0 | diff/count: 0 | change: 0.0%
count: 60 | rss: 73166848 | diff: 0 | diff/count: 0 | change: 0.0%

Which path level of SAP NWRFC SDK are you using?

If more detail analysis of memory leak required, you can also ceaate SAP customer incident, for component BC-MID-RFC-SDK and refer to this issue.

mpf82 commented 1 year ago

Output of pyrfc.get_nwrfclib_version() = {'major': 7500, 'minor': 0, 'patchLevel': 10, 'platform': 'win32'}

Python: 3.9.7

Properties of sapnwrfc.dll

grafik

I'll try to set this up with newer Python versions, though I slightly doubt that it's Python related.

mpf82 commented 1 year ago

I can still see an increase in memory usage with a clean Python 3.11.1 installation (only added psutil and pyrfc) in my windows env.

count: 10 | rss: 35532800 | diff: 0 | diff/count: 0 | change: 0.0%
count: 20 | rss: 35565568 | diff: 32768 | diff/count: 1638 | change: 0.09%
count: 30 | rss: 35594240 | diff: 61440 | diff/count: 2048 | change: 0.17%
count: 40 | rss: 35647488 | diff: 114688 | diff/count: 2867 | change: 0.32%
count: 50 | rss: 35667968 | diff: 135168 | diff/count: 2703 | change: 0.38%
count: 60 | rss: 35688448 | diff: 155648 | diff/count: 2594 | change: 0.44%
count: 70 | rss: 35700736 | diff: 167936 | diff/count: 2399 | change: 0.47%
count: 80 | rss: 35700736 | diff: 167936 | diff/count: 2099 | change: 0.47%
count: 90 | rss: 35700736 | diff: 167936 | diff/count: 1866 | change: 0.47%
count: 100 | rss: 35700736 | diff: 167936 | diff/count: 1679 | change: 0.47%
count: 200 | rss: 35778560 | diff: 245760 | diff/count: 1229 | change: 0.69%
count: 300 | rss: 35876864 | diff: 344064 | diff/count: 1147 | change: 0.97%
count: 400 | rss: 35917824 | diff: 385024 | diff/count: 963 | change: 1.08%
count: 500 | rss: 36003840 | diff: 471040 | diff/count: 942 | change: 1.33%
bsrdjan commented 1 year ago

Here are traces I captured on Windows, with Python 3.9.7 and SAP NWRFC SDK 7.50 PL10 and PL11

SAP NWRFC SDK 7.50.10

python .\ci\issues\i298.py
3.9.7 (tags/v3.9.7:1016ef3, Aug 30 2021, 20:19:38) [MSC v.1929 64 bit (AMD64)]
2.7.0 {'major': 7500, 'minor': 0, 'patchLevel': 10, 'platform': 'win32'}
rss_init: 30662656
count: 10 | rss: 30662656 | diff: 0 | diff/count: 0 | change: 0.0%
count: 20 | rss: 30674944 | diff: 12288 | diff/count: 614 | change: 0.04%
count: 30 | rss: 30679040 | diff: 16384 | diff/count: 546 | change: 0.05%
count: 40 | rss: 30683136 | diff: 20480 | diff/count: 512 | change: 0.07%
count: 50 | rss: 30683136 | diff: 20480 | diff/count: 410 | change: 0.07%
count: 60 | rss: 30728192 | diff: 65536 | diff/count: 1092 | change: 0.21%
count: 70 | rss: 30728192 | diff: 65536 | diff/count: 936 | change: 0.21%
count: 80 | rss: 30728192 | diff: 65536 | diff/count: 819 | change: 0.21%
count: 90 | rss: 30732288 | diff: 69632 | diff/count: 774 | change: 0.23%
count: 100 | rss: 30732288 | diff: 69632 | diff/count: 696 | change: 0.23%
count: 110 | rss: 30732288 | diff: 69632 | diff/count: 633 | change: 0.23%
count: 120 | rss: 30711808 | diff: 49152 | diff/count: 410 | change: 0.16%
count: 130 | rss: 30711808 | diff: 49152 | diff/count: 378 | change: 0.16%
count: 140 | rss: 30711808 | diff: 49152 | diff/count: 351 | change: 0.16%
count: 150 | rss: 30711808 | diff: 49152 | diff/count: 328 | change: 0.16%
count: 160 | rss: 30711808 | diff: 49152 | diff/count: 307 | change: 0.16%
count: 170 | rss: 30711808 | diff: 49152 | diff/count: 289 | change: 0.16%
count: 180 | rss: 30720000 | diff: 57344 | diff/count: 319 | change: 0.19%
count: 190 | rss: 30720000 | diff: 57344 | diff/count: 302 | change: 0.19%
count: 200 | rss: 30720000 | diff: 57344 | diff/count: 287 | change: 0.19%
count: 210 | rss: 30720000 | diff: 57344 | diff/count: 273 | change: 0.19%
count: 220 | rss: 30720000 | diff: 57344 | diff/count: 261 | change: 0.19%
count: 230 | rss: 30720000 | diff: 57344 | diff/count: 249 | change: 0.19%
count: 240 | rss: 30728192 | diff: 65536 | diff/count: 273 | change: 0.21%
count: 250 | rss: 30728192 | diff: 65536 | diff/count: 262 | change: 0.21%
count: 260 | rss: 30728192 | diff: 65536 | diff/count: 252 | change: 0.21%
count: 270 | rss: 30703616 | diff: 40960 | diff/count: 152 | change: 0.13%
count: 280 | rss: 30703616 | diff: 40960 | diff/count: 146 | change: 0.13%
count: 290 | rss: 30703616 | diff: 40960 | diff/count: 141 | change: 0.13%
count: 300 | rss: 30703616 | diff: 40960 | diff/count: 137 | change: 0.13%
count: 310 | rss: 30703616 | diff: 40960 | diff/count: 132 | change: 0.13%
count: 320 | rss: 30703616 | diff: 40960 | diff/count: 128 | change: 0.13%
count: 330 | rss: 30703616 | diff: 40960 | diff/count: 124 | change: 0.13%
count: 340 | rss: 30703616 | diff: 40960 | diff/count: 120 | change: 0.13%
count: 350 | rss: 30703616 | diff: 40960 | diff/count: 117 | change: 0.13%
count: 360 | rss: 30703616 | diff: 40960 | diff/count: 114 | change: 0.13%
count: 370 | rss: 30703616 | diff: 40960 | diff/count: 111 | change: 0.13%
count: 380 | rss: 30703616 | diff: 40960 | diff/count: 108 | change: 0.13%
count: 390 | rss: 30703616 | diff: 40960 | diff/count: 105 | change: 0.13%
count: 400 | rss: 30703616 | diff: 40960 | diff/count: 102 | change: 0.13%
count: 410 | rss: 30703616 | diff: 40960 | diff/count: 100 | change: 0.13%
count: 420 | rss: 30703616 | diff: 40960 | diff/count: 98 | change: 0.13%
count: 430 | rss: 30703616 | diff: 40960 | diff/count: 95 | change: 0.13%
count: 440 | rss: 30711808 | diff: 49152 | diff/count: 112 | change: 0.16%
count: 450 | rss: 30711808 | diff: 49152 | diff/count: 109 | change: 0.16%
count: 460 | rss: 30711808 | diff: 49152 | diff/count: 107 | change: 0.16%
count: 470 | rss: 30711808 | diff: 49152 | diff/count: 105 | change: 0.16%

SAP NWRFC SDK 7.50.11

python .\ci\issues\i298.py
3.9.7 (tags/v3.9.7:1016ef3, Aug 30 2021, 20:19:38) [MSC v.1929 64 bit (AMD64)]
2.7.0 {'major': 7500, 'minor': 0, 'patchLevel': 11, 'platform': 'win32'}
rss_init: 30285824
count: 10 | rss: 30285824 | diff: 0 | diff/count: 0 | change: 0.0%
count: 20 | rss: 30298112 | diff: 12288 | diff/count: 614 | change: 0.04%
count: 30 | rss: 30302208 | diff: 16384 | diff/count: 546 | change: 0.05%
count: 40 | rss: 30306304 | diff: 20480 | diff/count: 512 | change: 0.07%
count: 50 | rss: 30306304 | diff: 20480 | diff/count: 410 | change: 0.07%
count: 60 | rss: 30351360 | diff: 65536 | diff/count: 1092 | change: 0.22%
count: 70 | rss: 30351360 | diff: 65536 | diff/count: 936 | change: 0.22%
count: 80 | rss: 30347264 | diff: 61440 | diff/count: 768 | change: 0.2%
count: 90 | rss: 30347264 | diff: 61440 | diff/count: 683 | change: 0.2%
count: 100 | rss: 30347264 | diff: 61440 | diff/count: 614 | change: 0.2%
count: 110 | rss: 30347264 | diff: 61440 | diff/count: 559 | change: 0.2%
count: 120 | rss: 30347264 | diff: 61440 | diff/count: 512 | change: 0.2%
count: 130 | rss: 30318592 | diff: 32768 | diff/count: 252 | change: 0.11%
count: 140 | rss: 30318592 | diff: 32768 | diff/count: 234 | change: 0.11%
count: 150 | rss: 30318592 | diff: 32768 | diff/count: 218 | change: 0.11%
count: 160 | rss: 30326784 | diff: 40960 | diff/count: 256 | change: 0.14%
count: 170 | rss: 30326784 | diff: 40960 | diff/count: 241 | change: 0.14%
count: 180 | rss: 30326784 | diff: 40960 | diff/count: 228 | change: 0.14%
count: 190 | rss: 30326784 | diff: 40960 | diff/count: 216 | change: 0.14%
count: 200 | rss: 30326784 | diff: 40960 | diff/count: 205 | change: 0.14%
count: 210 | rss: 30326784 | diff: 40960 | diff/count: 195 | change: 0.14%
count: 220 | rss: 30326784 | diff: 40960 | diff/count: 186 | change: 0.14%
count: 230 | rss: 30326784 | diff: 40960 | diff/count: 178 | change: 0.14%
count: 240 | rss: 30326784 | diff: 40960 | diff/count: 171 | change: 0.14%
count: 250 | rss: 30334976 | diff: 49152 | diff/count: 197 | change: 0.16%
count: 260 | rss: 30334976 | diff: 49152 | diff/count: 189 | change: 0.16%
count: 270 | rss: 30310400 | diff: 24576 | diff/count: 91 | change: 0.08%
count: 280 | rss: 30310400 | diff: 24576 | diff/count: 88 | change: 0.08%
count: 290 | rss: 30310400 | diff: 24576 | diff/count: 85 | change: 0.08%
count: 300 | rss: 30310400 | diff: 24576 | diff/count: 82 | change: 0.08%
count: 310 | rss: 30310400 | diff: 24576 | diff/count: 79 | change: 0.08%
count: 320 | rss: 30310400 | diff: 24576 | diff/count: 77 | change: 0.08%
count: 330 | rss: 30310400 | diff: 24576 | diff/count: 74 | change: 0.08%
count: 340 | rss: 30310400 | diff: 24576 | diff/count: 72 | change: 0.08%
count: 350 | rss: 30310400 | diff: 24576 | diff/count: 70 | change: 0.08%
count: 360 | rss: 30310400 | diff: 24576 | diff/count: 68 | change: 0.08%
count: 370 | rss: 30310400 | diff: 24576 | diff/count: 66 | change: 0.08%
count: 380 | rss: 30310400 | diff: 24576 | diff/count: 65 | change: 0.08%
count: 390 | rss: 30310400 | diff: 24576 | diff/count: 63 | change: 0.08%
count: 400 | rss: 30310400 | diff: 24576 | diff/count: 61 | change: 0.08%
count: 410 | rss: 30310400 | diff: 24576 | diff/count: 60 | change: 0.08%
count: 420 | rss: 30310400 | diff: 24576 | diff/count: 59 | change: 0.08%
count: 430 | rss: 30310400 | diff: 24576 | diff/count: 57 | change: 0.08%
count: 440 | rss: 30310400 | diff: 24576 | diff/count: 56 | change: 0.08%
count: 450 | rss: 30310400 | diff: 24576 | diff/count: 55 | change: 0.08%
count: 460 | rss: 30310400 | diff: 24576 | diff/count: 53 | change: 0.08%
count: 470 | rss: 30310400 | diff: 24576 | diff/count: 52 | change: 0.08%
count: 480 | rss: 30310400 | diff: 24576 | diff/count: 51 | change: 0.08%
count: 490 | rss: 30310400 | diff: 24576 | diff/count: 50 | change: 0.08%

I could not reproduce the permanent increase but consumption looks lightly less with SAP NWRFC SDK PL11 (just released). One memory leak fix is mentioned in PL11 release notes, perhaps relevant in your scenario. Can you try and post the trace, if the issue happens in your system also with 7.50 patch level 11 ?

mpf82 commented 1 year ago

Thanks for taking the time and doing all the testing.

I really wonder what's the difference between our environments ...

3.11.1 (main, Feb  1 2023, 10:52:25) [GCC 8.5.0 20210514 (Red Hat 8.5.0-4)]
{'major': 7500, 'minor': 0, 'patchLevel': 10, 'platform': 'linux'}
PID: 1524106
rss_init: 34217984
count: 10 | rss: 34217984 | diff: 0 | diff/count: 0 | change: 0.0%
count: 20 | rss: 34217984 | diff: 0 | diff/count: 0 | change: 0.0%
count: 30 | rss: 34217984 | diff: 0 | diff/count: 0 | change: 0.0%
count: 40 | rss: 34217984 | diff: 0 | diff/count: 0 | change: 0.0%
count: 50 | rss: 34217984 | diff: 0 | diff/count: 0 | change: 0.0%
count: 60 | rss: 34217984 | diff: 0 | diff/count: 0 | change: 0.0%
count: 70 | rss: 34217984 | diff: 0 | diff/count: 0 | change: 0.0%
count: 80 | rss: 34217984 | diff: 0 | diff/count: 0 | change: 0.0%
count: 90 | rss: 34217984 | diff: 0 | diff/count: 0 | change: 0.0%
count: 100 | rss: 34217984 | diff: 0 | diff/count: 0 | change: 0.0%
count: 110 | rss: 34217984 | diff: 0 | diff/count: 0 | change: 0.0%
count: 120 | rss: 34217984 | diff: 0 | diff/count: 0 | change: 0.0%
count: 130 | rss: 34217984 | diff: 0 | diff/count: 0 | change: 0.0%
count: 140 | rss: 34217984 | diff: 0 | diff/count: 0 | change: 0.0%
count: 150 | rss: 34217984 | diff: 0 | diff/count: 0 | change: 0.0%
count: 160 | rss: 34217984 | diff: 0 | diff/count: 0 | change: 0.0%
count: 170 | rss: 34217984 | diff: 0 | diff/count: 0 | change: 0.0%
count: 180 | rss: 34217984 | diff: 0 | diff/count: 0 | change: 0.0%
count: 190 | rss: 34746368 | diff: 528384 | diff/count: 2781 | change: 1.54%
count: 200 | rss: 34746368 | diff: 528384 | diff/count: 2642 | change: 1.54%
count: 400 | rss: 34820096 | diff: 602112 | diff/count: 1505 | change: 1.76%
count: 500 | rss: 34877440 | diff: 659456 | diff/count: 1319 | change: 1.93%
count: 750 | rss: 34996224 | diff: 778240 | diff/count: 1038 | change: 2.27%
count: 1000 | rss: 35057664 | diff: 839680 | diff/count: 840 | change: 2.45%
count: 1250 | rss: 35176448 | diff: 958464 | diff/count: 767 | change: 2.8%
count: 1500 | rss: 35291136 | diff: 1073152 | diff/count: 715 | change: 3.14%
count: 1700 | rss: 35291136 | diff: 1073152 | diff/count: 631 | change: 3.14%
Python: 3.11.1 (main, Feb 1 2023, 10:52:25) [GCC 8.5.0 20210514 (Red Hat 8.5.0-4)]
{'major': 7500, 'minor': 0, 'patchLevel': 11, 'platform': 'linux'}
PID: 1525422
rss_init: 34127872
count: 10 | rss: 34127872 | diff: 0 | diff/count: 0 | change: 0.0%
count: 20 | rss: 34127872 | diff: 0 | diff/count: 0 | change: 0.0%
count: 30 | rss: 34127872 | diff: 0 | diff/count: 0 | change: 0.0%
count: 40 | rss: 34127872 | diff: 0 | diff/count: 0 | change: 0.0%
count: 50 | rss: 34127872 | diff: 0 | diff/count: 0 | change: 0.0%
count: 60 | rss: 34127872 | diff: 0 | diff/count: 0 | change: 0.0%
count: 70 | rss: 34127872 | diff: 0 | diff/count: 0 | change: 0.0%
count: 80 | rss: 34127872 | diff: 0 | diff/count: 0 | change: 0.0%
count: 90 | rss: 34705408 | diff: 577536 | diff/count: 6417 | change: 1.69%
count: 100 | rss: 34705408 | diff: 577536 | diff/count: 5775 | change: 1.69%
count: 110 | rss: 34705408 | diff: 577536 | diff/count: 5250 | change: 1.69%
count: 120 | rss: 34705408 | diff: 577536 | diff/count: 4813 | change: 1.69%
count: 130 | rss: 34705408 | diff: 577536 | diff/count: 4443 | change: 1.69%
count: 140 | rss: 34705408 | diff: 577536 | diff/count: 4125 | change: 1.69%
count: 150 | rss: 34705408 | diff: 577536 | diff/count: 3850 | change: 1.69%
count: 200 | rss: 34705408 | diff: 577536 | diff/count: 2888 | change: 1.69%
count: 300 | rss: 34840576 | diff: 712704 | diff/count: 2376 | change: 2.09%
count: 500 | rss: 34947072 | diff: 819200 | diff/count: 1638 | change: 2.4%
count: 750 | rss: 34947072 | diff: 819200 | diff/count: 1092 | change: 2.4%
count: 1000 | rss: 35127296 | diff: 999424 | diff/count: 999 | change: 2.93%
count: 1250 | rss: 35196928 | diff: 1069056 | diff/count: 855 | change: 3.13%
count: 1500 | rss: 35323904 | diff: 1196032 | diff/count: 797 | change: 3.5%

Note that on our Red Hat system, the increase in the first test only happened after around 200 connection calls - so maybe if you had kept your test app running for longer you would have seen a memory increase, too? (referring to first test logs: https://github.com/SAP/PyRFC/issues/298#issuecomment-1408478077)


3.9.13 (tags/v3.9.13:6de2ca5, May 17 2022, 16:36:42) [MSC v.1929 64 bit (AMD64)]
2.7.0 {'major': 7500, 'minor': 0, 'patchLevel': 11, 'platform': 'win32'}
PID: 1984
rss_init: 34631680
count: 10 | rss: 34631680 | diff: 0 | diff/count: 0 | change: 0.0%
count: 20 | rss: 34664448 | diff: 32768 | diff/count: 1638 | change: 0.09%
count: 30 | rss: 34734080 | diff: 102400 | diff/count: 3413 | change: 0.3%
count: 40 | rss: 34807808 | diff: 176128 | diff/count: 4403 | change: 0.51%
count: 50 | rss: 34828288 | diff: 196608 | diff/count: 3932 | change: 0.57%
count: 60 | rss: 34848768 | diff: 217088 | diff/count: 3618 | change: 0.63%
count: 70 | rss: 34852864 | diff: 221184 | diff/count: 3160 | change: 0.64%
count: 80 | rss: 34799616 | diff: 167936 | diff/count: 2099 | change: 0.48%
count: 90 | rss: 34799616 | diff: 167936 | diff/count: 1866 | change: 0.48%
count: 100 | rss: 34803712 | diff: 172032 | diff/count: 1720 | change: 0.5%
count: 200 | rss: 34824192 | diff: 192512 | diff/count: 963 | change: 0.56%
count: 300 | rss: 34861056 | diff: 229376 | diff/count: 765 | change: 0.66%
count: 400 | rss: 34959360 | diff: 327680 | diff/count: 819 | change: 0.95%
count: 500 | rss: 35016704 | diff: 385024 | diff/count: 770 | change: 1.11%
count: 600 | rss: 35037184 | diff: 405504 | diff/count: 676 | change: 1.17%
3.11.1 (tags/v3.11.1:a7a450f, Dec  6 2022, 19:58:39) [MSC v.1934 64 bit (AMD64)]
2.7.0 {'major': 7500, 'minor': 0, 'patchLevel': 11, 'platform': 'win32'}
PID: 18712
rss_init: 35266560
count: 10 | rss: 35266560 | diff: 0 | diff/count: 0 | change: 0.0%
count: 20 | rss: 35295232 | diff: 28672 | diff/count: 1434 | change: 0.08%
count: 30 | rss: 35323904 | diff: 57344 | diff/count: 1911 | change: 0.16%
count: 40 | rss: 35393536 | diff: 126976 | diff/count: 3174 | change: 0.36%
count: 50 | rss: 35418112 | diff: 151552 | diff/count: 3031 | change: 0.43%
count: 60 | rss: 35438592 | diff: 172032 | diff/count: 2867 | change: 0.49%
count: 70 | rss: 35442688 | diff: 176128 | diff/count: 2516 | change: 0.5%
count: 80 | rss: 35389440 | diff: 122880 | diff/count: 1536 | change: 0.35%
count: 90 | rss: 35389440 | diff: 122880 | diff/count: 1365 | change: 0.35%
count: 100 | rss: 35389440 | diff: 122880 | diff/count: 1229 | change: 0.35%
count: 200 | rss: 35364864 | diff: 98304 | diff/count: 492 | change: 0.28%
count: 300 | rss: 35438592 | diff: 172032 | diff/count: 573 | change: 0.49%
count: 400 | rss: 35545088 | diff: 278528 | diff/count: 696 | change: 0.79%
count: 500 | rss: 35598336 | diff: 331776 | diff/count: 664 | change: 0.94%
count: 600 | rss: 35606528 | diff: 339968 | diff/count: 567 | change: 0.96%
count: 700 | rss: 35622912 | diff: 356352 | diff/count: 509 | change: 1.01%
count: 900 | rss: 35782656 | diff: 516096 | diff/count: 573 | change: 1.46%

The increase seems indeed less with Patch 11, but it's still there (at least on my machine). There's a drop at 200 connections with Python 3.11, but then it's going up again.


I'm really baffled. I even added del cnxn to the while loop (after the close() call) and I also added gc.collect() inside mem_diff() to trigger the garbage collector every 10 connection calls, but there was no difference in the memory increase.

bsrdjan commented 1 year ago

Can you try with exactly the same script I posted above and attach the full log file?

mpf82 commented 1 year ago

Can you try with exactly the same script I posted above and attach the full log file?

Sure. Well, I had to modify the params to Connection(), otherwise it's the same script that you posted on January, 30th.

Linux:

3.11.1 (main, Feb  1 2023, 10:52:25) [GCC 8.5.0 20210514 (Red Hat 8.5.0-4)]
2.7.0 {'major': 7500, 'minor': 0, 'patchLevel': 11, 'platform': 'linux'}
rss_init: 34078720
count: 10 | rss: 34078720 | diff: 0 | diff/count: 0 | change: 0.0%
count: 20 | rss: 34078720 | diff: 0 | diff/count: 0 | change: 0.0%
count: 30 | rss: 34078720 | diff: 0 | diff/count: 0 | change: 0.0%
count: 40 | rss: 34078720 | diff: 0 | diff/count: 0 | change: 0.0%
count: 50 | rss: 34078720 | diff: 0 | diff/count: 0 | change: 0.0%
count: 60 | rss: 34078720 | diff: 0 | diff/count: 0 | change: 0.0%
count: 70 | rss: 34078720 | diff: 0 | diff/count: 0 | change: 0.0%
count: 80 | rss: 34078720 | diff: 0 | diff/count: 0 | change: 0.0%
count: 90 | rss: 34078720 | diff: 0 | diff/count: 0 | change: 0.0%
count: 100 | rss: 34078720 | diff: 0 | diff/count: 0 | change: 0.0%
count: 110 | rss: 34078720 | diff: 0 | diff/count: 0 | change: 0.0%
count: 120 | rss: 34078720 | diff: 0 | diff/count: 0 | change: 0.0%
count: 130 | rss: 34078720 | diff: 0 | diff/count: 0 | change: 0.0%
count: 140 | rss: 34078720 | diff: 0 | diff/count: 0 | change: 0.0%
count: 150 | rss: 34078720 | diff: 0 | diff/count: 0 | change: 0.0%
count: 160 | rss: 34078720 | diff: 0 | diff/count: 0 | change: 0.0%
count: 170 | rss: 34078720 | diff: 0 | diff/count: 0 | change: 0.0%
count: 180 | rss: 34078720 | diff: 0 | diff/count: 0 | change: 0.0%
count: 190 | rss: 34078720 | diff: 0 | diff/count: 0 | change: 0.0%
count: 200 | rss: 34648064 | diff: 569344 | diff/count: 2847 | change: 1.67%
count: 210 | rss: 34648064 | diff: 569344 | diff/count: 2711 | change: 1.67%
count: 220 | rss: 34648064 | diff: 569344 | diff/count: 2588 | change: 1.67%
count: 230 | rss: 34648064 | diff: 569344 | diff/count: 2475 | change: 1.67%
count: 240 | rss: 34648064 | diff: 569344 | diff/count: 2372 | change: 1.67%
count: 250 | rss: 34648064 | diff: 569344 | diff/count: 2277 | change: 1.67%
count: 260 | rss: 34648064 | diff: 569344 | diff/count: 2190 | change: 1.67%
count: 270 | rss: 34648064 | diff: 569344 | diff/count: 2109 | change: 1.67%
count: 280 | rss: 34648064 | diff: 569344 | diff/count: 2033 | change: 1.67%
count: 290 | rss: 34648064 | diff: 569344 | diff/count: 1963 | change: 1.67%
count: 300 | rss: 34709504 | diff: 630784 | diff/count: 2103 | change: 1.85%
count: 310 | rss: 34709504 | diff: 630784 | diff/count: 2035 | change: 1.85%
count: 320 | rss: 34709504 | diff: 630784 | diff/count: 1971 | change: 1.85%
count: 330 | rss: 34709504 | diff: 630784 | diff/count: 1911 | change: 1.85%
count: 340 | rss: 34709504 | diff: 630784 | diff/count: 1855 | change: 1.85%
count: 350 | rss: 34709504 | diff: 630784 | diff/count: 1802 | change: 1.85%
count: 360 | rss: 34709504 | diff: 630784 | diff/count: 1752 | change: 1.85%
count: 370 | rss: 34709504 | diff: 630784 | diff/count: 1705 | change: 1.85%
count: 380 | rss: 34709504 | diff: 630784 | diff/count: 1660 | change: 1.85%
count: 390 | rss: 34709504 | diff: 630784 | diff/count: 1617 | change: 1.85%
count: 400 | rss: 34709504 | diff: 630784 | diff/count: 1577 | change: 1.85%
count: 410 | rss: 34709504 | diff: 630784 | diff/count: 1538 | change: 1.85%
count: 420 | rss: 34709504 | diff: 630784 | diff/count: 1502 | change: 1.85%
count: 430 | rss: 34709504 | diff: 630784 | diff/count: 1467 | change: 1.85%
count: 440 | rss: 34709504 | diff: 630784 | diff/count: 1434 | change: 1.85%
count: 450 | rss: 34709504 | diff: 630784 | diff/count: 1402 | change: 1.85%
count: 460 | rss: 34709504 | diff: 630784 | diff/count: 1371 | change: 1.85%
count: 470 | rss: 34709504 | diff: 630784 | diff/count: 1342 | change: 1.85%
count: 480 | rss: 34709504 | diff: 630784 | diff/count: 1314 | change: 1.85%
count: 490 | rss: 34709504 | diff: 630784 | diff/count: 1287 | change: 1.85%
count: 500 | rss: 34709504 | diff: 630784 | diff/count: 1262 | change: 1.85%
count: 510 | rss: 34709504 | diff: 630784 | diff/count: 1237 | change: 1.85%
count: 520 | rss: 34709504 | diff: 630784 | diff/count: 1213 | change: 1.85%
count: 530 | rss: 34709504 | diff: 630784 | diff/count: 1190 | change: 1.85%
count: 540 | rss: 34709504 | diff: 630784 | diff/count: 1168 | change: 1.85%
count: 550 | rss: 34795520 | diff: 716800 | diff/count: 1303 | change: 2.1%
count: 560 | rss: 34795520 | diff: 716800 | diff/count: 1280 | change: 2.1%
count: 570 | rss: 34795520 | diff: 716800 | diff/count: 1258 | change: 2.1%
count: 580 | rss: 34795520 | diff: 716800 | diff/count: 1236 | change: 2.1%
count: 590 | rss: 34795520 | diff: 716800 | diff/count: 1215 | change: 2.1%
count: 600 | rss: 34795520 | diff: 716800 | diff/count: 1195 | change: 2.1%
count: 610 | rss: 34795520 | diff: 716800 | diff/count: 1175 | change: 2.1%
count: 620 | rss: 34795520 | diff: 716800 | diff/count: 1156 | change: 2.1%
count: 630 | rss: 34795520 | diff: 716800 | diff/count: 1138 | change: 2.1%
count: 640 | rss: 34795520 | diff: 716800 | diff/count: 1120 | change: 2.1%
count: 650 | rss: 34795520 | diff: 716800 | diff/count: 1103 | change: 2.1%
count: 660 | rss: 34795520 | diff: 716800 | diff/count: 1086 | change: 2.1%
count: 670 | rss: 34795520 | diff: 716800 | diff/count: 1070 | change: 2.1%
count: 680 | rss: 34795520 | diff: 716800 | diff/count: 1054 | change: 2.1%
count: 690 | rss: 34795520 | diff: 716800 | diff/count: 1039 | change: 2.1%
count: 700 | rss: 34795520 | diff: 716800 | diff/count: 1024 | change: 2.1%
count: 710 | rss: 34795520 | diff: 716800 | diff/count: 1010 | change: 2.1%
count: 720 | rss: 34795520 | diff: 716800 | diff/count: 996 | change: 2.1%
count: 730 | rss: 34795520 | diff: 716800 | diff/count: 982 | change: 2.1%
count: 740 | rss: 34795520 | diff: 716800 | diff/count: 969 | change: 2.1%
count: 750 | rss: 34795520 | diff: 716800 | diff/count: 956 | change: 2.1%
count: 760 | rss: 34795520 | diff: 716800 | diff/count: 943 | change: 2.1%
count: 770 | rss: 34795520 | diff: 716800 | diff/count: 931 | change: 2.1%
count: 780 | rss: 34795520 | diff: 716800 | diff/count: 919 | change: 2.1%
count: 790 | rss: 34795520 | diff: 716800 | diff/count: 907 | change: 2.1%
count: 800 | rss: 34922496 | diff: 843776 | diff/count: 1055 | change: 2.48%
count: 810 | rss: 34922496 | diff: 843776 | diff/count: 1042 | change: 2.48%
count: 820 | rss: 34922496 | diff: 843776 | diff/count: 1029 | change: 2.48%
count: 830 | rss: 34922496 | diff: 843776 | diff/count: 1017 | change: 2.48%
count: 840 | rss: 34922496 | diff: 843776 | diff/count: 1004 | change: 2.48%
count: 850 | rss: 34922496 | diff: 843776 | diff/count: 993 | change: 2.48%
count: 860 | rss: 34922496 | diff: 843776 | diff/count: 981 | change: 2.48%
count: 870 | rss: 34922496 | diff: 843776 | diff/count: 970 | change: 2.48%
count: 880 | rss: 34922496 | diff: 843776 | diff/count: 959 | change: 2.48%
count: 890 | rss: 34922496 | diff: 843776 | diff/count: 948 | change: 2.48%
count: 900 | rss: 34922496 | diff: 843776 | diff/count: 938 | change: 2.48%
count: 910 | rss: 34922496 | diff: 843776 | diff/count: 927 | change: 2.48%
count: 920 | rss: 34922496 | diff: 843776 | diff/count: 917 | change: 2.48%
count: 930 | rss: 34922496 | diff: 843776 | diff/count: 907 | change: 2.48%
count: 940 | rss: 34979840 | diff: 901120 | diff/count: 959 | change: 2.64%
count: 950 | rss: 34979840 | diff: 901120 | diff/count: 949 | change: 2.64%
count: 960 | rss: 34979840 | diff: 901120 | diff/count: 939 | change: 2.64%
count: 970 | rss: 34979840 | diff: 901120 | diff/count: 929 | change: 2.64%
count: 980 | rss: 34979840 | diff: 901120 | diff/count: 920 | change: 2.64%
count: 990 | rss: 34979840 | diff: 901120 | diff/count: 910 | change: 2.64%
count: 1000 | rss: 34979840 | diff: 901120 | diff/count: 901 | change: 2.64%
count: 1010 | rss: 34979840 | diff: 901120 | diff/count: 892 | change: 2.64%
count: 1020 | rss: 34979840 | diff: 901120 | diff/count: 883 | change: 2.64%
count: 1030 | rss: 34979840 | diff: 901120 | diff/count: 875 | change: 2.64%
count: 1040 | rss: 34979840 | diff: 901120 | diff/count: 866 | change: 2.64%
count: 1050 | rss: 34979840 | diff: 901120 | diff/count: 858 | change: 2.64%
count: 1060 | rss: 34979840 | diff: 901120 | diff/count: 850 | change: 2.64%
count: 1070 | rss: 34979840 | diff: 901120 | diff/count: 842 | change: 2.64%
count: 1080 | rss: 34979840 | diff: 901120 | diff/count: 834 | change: 2.64%
count: 1090 | rss: 34979840 | diff: 901120 | diff/count: 827 | change: 2.64%
count: 1100 | rss: 34979840 | diff: 901120 | diff/count: 819 | change: 2.64%
count: 1110 | rss: 34979840 | diff: 901120 | diff/count: 812 | change: 2.64%
count: 1120 | rss: 34979840 | diff: 901120 | diff/count: 805 | change: 2.64%
count: 1130 | rss: 34979840 | diff: 901120 | diff/count: 797 | change: 2.64%
count: 1140 | rss: 34979840 | diff: 901120 | diff/count: 790 | change: 2.64%
count: 1150 | rss: 34979840 | diff: 901120 | diff/count: 784 | change: 2.64%
count: 1160 | rss: 34979840 | diff: 901120 | diff/count: 777 | change: 2.64%
count: 1170 | rss: 35061760 | diff: 983040 | diff/count: 840 | change: 2.88%
count: 1180 | rss: 35061760 | diff: 983040 | diff/count: 833 | change: 2.88%
count: 1190 | rss: 35061760 | diff: 983040 | diff/count: 826 | change: 2.88%
count: 1200 | rss: 35061760 | diff: 983040 | diff/count: 819 | change: 2.88%
count: 1210 | rss: 35061760 | diff: 983040 | diff/count: 812 | change: 2.88%
count: 1220 | rss: 35061760 | diff: 983040 | diff/count: 806 | change: 2.88%
count: 1230 | rss: 35061760 | diff: 983040 | diff/count: 799 | change: 2.88%
count: 1240 | rss: 35061760 | diff: 983040 | diff/count: 793 | change: 2.88%
count: 1250 | rss: 35061760 | diff: 983040 | diff/count: 786 | change: 2.88%
count: 1260 | rss: 35061760 | diff: 983040 | diff/count: 780 | change: 2.88%
count: 1270 | rss: 35061760 | diff: 983040 | diff/count: 774 | change: 2.88%
count: 1280 | rss: 35061760 | diff: 983040 | diff/count: 768 | change: 2.88%
count: 1290 | rss: 35061760 | diff: 983040 | diff/count: 762 | change: 2.88%
count: 1300 | rss: 35061760 | diff: 983040 | diff/count: 756 | change: 2.88%
count: 1310 | rss: 35061760 | diff: 983040 | diff/count: 750 | change: 2.88%
count: 1320 | rss: 35061760 | diff: 983040 | diff/count: 745 | change: 2.88%
count: 1330 | rss: 35061760 | diff: 983040 | diff/count: 739 | change: 2.88%
count: 1340 | rss: 35061760 | diff: 983040 | diff/count: 734 | change: 2.88%
count: 1350 | rss: 35061760 | diff: 983040 | diff/count: 728 | change: 2.88%
count: 1360 | rss: 35061760 | diff: 983040 | diff/count: 723 | change: 2.88%
count: 1370 | rss: 35061760 | diff: 983040 | diff/count: 718 | change: 2.88%
count: 1380 | rss: 35061760 | diff: 983040 | diff/count: 712 | change: 2.88%
count: 1390 | rss: 35061760 | diff: 983040 | diff/count: 707 | change: 2.88%
count: 1400 | rss: 35061760 | diff: 983040 | diff/count: 702 | change: 2.88%
count: 1410 | rss: 35192832 | diff: 1114112 | diff/count: 790 | change: 3.27%
count: 1420 | rss: 35192832 | diff: 1114112 | diff/count: 785 | change: 3.27%
count: 1430 | rss: 35192832 | diff: 1114112 | diff/count: 779 | change: 3.27%
count: 1440 | rss: 35192832 | diff: 1114112 | diff/count: 774 | change: 3.27%
count: 1450 | rss: 35192832 | diff: 1114112 | diff/count: 768 | change: 3.27%
count: 1460 | rss: 35192832 | diff: 1114112 | diff/count: 763 | change: 3.27%
count: 1470 | rss: 35192832 | diff: 1114112 | diff/count: 758 | change: 3.27%
count: 1480 | rss: 35192832 | diff: 1114112 | diff/count: 753 | change: 3.27%
count: 1490 | rss: 35192832 | diff: 1114112 | diff/count: 748 | change: 3.27%
count: 1500 | rss: 35192832 | diff: 1114112 | diff/count: 743 | change: 3.27%
count: 1510 | rss: 35192832 | diff: 1114112 | diff/count: 738 | change: 3.27%
count: 1520 | rss: 35192832 | diff: 1114112 | diff/count: 733 | change: 3.27%
count: 1530 | rss: 35192832 | diff: 1114112 | diff/count: 728 | change: 3.27%
count: 1540 | rss: 35192832 | diff: 1114112 | diff/count: 723 | change: 3.27%
count: 1550 | rss: 35192832 | diff: 1114112 | diff/count: 719 | change: 3.27%
count: 1560 | rss: 35192832 | diff: 1114112 | diff/count: 714 | change: 3.27%
count: 1570 | rss: 35192832 | diff: 1114112 | diff/count: 710 | change: 3.27%
count: 1580 | rss: 35192832 | diff: 1114112 | diff/count: 705 | change: 3.27%
count: 1590 | rss: 35192832 | diff: 1114112 | diff/count: 701 | change: 3.27%
count: 1600 | rss: 35192832 | diff: 1114112 | diff/count: 696 | change: 3.27%
count: 1610 | rss: 35192832 | diff: 1114112 | diff/count: 692 | change: 3.27%
count: 1620 | rss: 35192832 | diff: 1114112 | diff/count: 688 | change: 3.27%
count: 1630 | rss: 35266560 | diff: 1187840 | diff/count: 729 | change: 3.49%
count: 1640 | rss: 35266560 | diff: 1187840 | diff/count: 724 | change: 3.49%
count: 1650 | rss: 35266560 | diff: 1187840 | diff/count: 720 | change: 3.49%
count: 1660 | rss: 35266560 | diff: 1187840 | diff/count: 716 | change: 3.49%
count: 1670 | rss: 35266560 | diff: 1187840 | diff/count: 711 | change: 3.49%
count: 1680 | rss: 35266560 | diff: 1187840 | diff/count: 707 | change: 3.49%
count: 1690 | rss: 35266560 | diff: 1187840 | diff/count: 703 | change: 3.49%
count: 1700 | rss: 35266560 | diff: 1187840 | diff/count: 699 | change: 3.49%
count: 1710 | rss: 35266560 | diff: 1187840 | diff/count: 695 | change: 3.49%
count: 1720 | rss: 35315712 | diff: 1236992 | diff/count: 719 | change: 3.63%
count: 1730 | rss: 35315712 | diff: 1236992 | diff/count: 715 | change: 3.63%
count: 1740 | rss: 35315712 | diff: 1236992 | diff/count: 711 | change: 3.63%
count: 1750 | rss: 35315712 | diff: 1236992 | diff/count: 707 | change: 3.63%
count: 1760 | rss: 35315712 | diff: 1236992 | diff/count: 703 | change: 3.63%
count: 1770 | rss: 35315712 | diff: 1236992 | diff/count: 699 | change: 3.63%
count: 1780 | rss: 35315712 | diff: 1236992 | diff/count: 695 | change: 3.63%
count: 1790 | rss: 35315712 | diff: 1236992 | diff/count: 691 | change: 3.63%
count: 1800 | rss: 35315712 | diff: 1236992 | diff/count: 687 | change: 3.63%
count: 1810 | rss: 35315712 | diff: 1236992 | diff/count: 683 | change: 3.63%
count: 1820 | rss: 35315712 | diff: 1236992 | diff/count: 680 | change: 3.63%
count: 1830 | rss: 35315712 | diff: 1236992 | diff/count: 676 | change: 3.63%
count: 1840 | rss: 35315712 | diff: 1236992 | diff/count: 672 | change: 3.63%
count: 1850 | rss: 35315712 | diff: 1236992 | diff/count: 669 | change: 3.63%
count: 1860 | rss: 35315712 | diff: 1236992 | diff/count: 665 | change: 3.63%
count: 1870 | rss: 35315712 | diff: 1236992 | diff/count: 661 | change: 3.63%
count: 1880 | rss: 35315712 | diff: 1236992 | diff/count: 658 | change: 3.63%
count: 1890 | rss: 35315712 | diff: 1236992 | diff/count: 654 | change: 3.63%
count: 1900 | rss: 35315712 | diff: 1236992 | diff/count: 651 | change: 3.63%
count: 1910 | rss: 35315712 | diff: 1236992 | diff/count: 648 | change: 3.63%

Windows, Python 3.9

3.9.13 (tags/v3.9.13:6de2ca5, May 17 2022, 16:36:42) [MSC v.1929 64 bit (AMD64)]
2.7.0 {'major': 7500, 'minor': 0, 'patchLevel': 11, 'platform': 'win32'}
rss_init: 34656256
count: 10 | rss: 34656256 | diff: 0 | diff/count: 0 | change: 0.0%
count: 20 | rss: 34713600 | diff: 57344 | diff/count: 2867 | change: 0.17%
count: 30 | rss: 34738176 | diff: 81920 | diff/count: 2731 | change: 0.24%
count: 40 | rss: 34758656 | diff: 102400 | diff/count: 2560 | change: 0.3%
count: 50 | rss: 34779136 | diff: 122880 | diff/count: 2458 | change: 0.35%
count: 60 | rss: 34799616 | diff: 143360 | diff/count: 2389 | change: 0.41%
count: 70 | rss: 34803712 | diff: 147456 | diff/count: 2107 | change: 0.43%
count: 80 | rss: 34803712 | diff: 147456 | diff/count: 1843 | change: 0.43%
count: 90 | rss: 34803712 | diff: 147456 | diff/count: 1638 | change: 0.43%
count: 100 | rss: 34803712 | diff: 147456 | diff/count: 1475 | change: 0.43%
count: 110 | rss: 34803712 | diff: 147456 | diff/count: 1341 | change: 0.43%
count: 120 | rss: 34803712 | diff: 147456 | diff/count: 1229 | change: 0.43%
count: 130 | rss: 34803712 | diff: 147456 | diff/count: 1134 | change: 0.43%
count: 140 | rss: 34791424 | diff: 135168 | diff/count: 965 | change: 0.39%
count: 150 | rss: 34791424 | diff: 135168 | diff/count: 901 | change: 0.39%
count: 160 | rss: 34791424 | diff: 135168 | diff/count: 845 | change: 0.39%
count: 170 | rss: 34791424 | diff: 135168 | diff/count: 795 | change: 0.39%
count: 180 | rss: 34791424 | diff: 135168 | diff/count: 751 | change: 0.39%
count: 190 | rss: 34791424 | diff: 135168 | diff/count: 711 | change: 0.39%
count: 200 | rss: 34791424 | diff: 135168 | diff/count: 676 | change: 0.39%
count: 210 | rss: 34791424 | diff: 135168 | diff/count: 644 | change: 0.39%
count: 220 | rss: 34791424 | diff: 135168 | diff/count: 614 | change: 0.39%
count: 230 | rss: 34803712 | diff: 147456 | diff/count: 641 | change: 0.43%
count: 240 | rss: 34803712 | diff: 147456 | diff/count: 614 | change: 0.43%
count: 250 | rss: 34811904 | diff: 155648 | diff/count: 623 | change: 0.45%
count: 260 | rss: 34836480 | diff: 180224 | diff/count: 693 | change: 0.52%
count: 270 | rss: 34836480 | diff: 180224 | diff/count: 667 | change: 0.52%
count: 280 | rss: 34836480 | diff: 180224 | diff/count: 644 | change: 0.52%
count: 290 | rss: 34836480 | diff: 180224 | diff/count: 621 | change: 0.52%
count: 300 | rss: 34836480 | diff: 180224 | diff/count: 601 | change: 0.52%
count: 310 | rss: 34906112 | diff: 249856 | diff/count: 806 | change: 0.72%

Windows, Python 3.11

3.11.1 (tags/v3.11.1:a7a450f, Dec  6 2022, 19:58:39) [MSC v.1934 64 bit (AMD64)]
2.7.0 {'major': 7500, 'minor': 0, 'patchLevel': 11, 'platform': 'win32'}
rss_init: 34897920
count: 10 | rss: 34897920 | diff: 0 | diff/count: 0 | change: 0.0%
count: 20 | rss: 34975744 | diff: 77824 | diff/count: 3891 | change: 0.22%
count: 30 | rss: 35000320 | diff: 102400 | diff/count: 3413 | change: 0.29%
count: 40 | rss: 35020800 | diff: 122880 | diff/count: 3072 | change: 0.35%
count: 50 | rss: 35041280 | diff: 143360 | diff/count: 2867 | change: 0.41%
count: 60 | rss: 35061760 | diff: 163840 | diff/count: 2731 | change: 0.47%
count: 70 | rss: 35065856 | diff: 167936 | diff/count: 2399 | change: 0.48%
count: 80 | rss: 35065856 | diff: 167936 | diff/count: 2099 | change: 0.48%
count: 90 | rss: 35065856 | diff: 167936 | diff/count: 1866 | change: 0.48%
count: 100 | rss: 35069952 | diff: 172032 | diff/count: 1720 | change: 0.49%
count: 110 | rss: 35069952 | diff: 172032 | diff/count: 1564 | change: 0.49%
count: 120 | rss: 35069952 | diff: 172032 | diff/count: 1434 | change: 0.49%
count: 130 | rss: 35069952 | diff: 172032 | diff/count: 1323 | change: 0.49%
count: 140 | rss: 35069952 | diff: 172032 | diff/count: 1229 | change: 0.49%
count: 150 | rss: 35041280 | diff: 143360 | diff/count: 956 | change: 0.41%
count: 160 | rss: 35041280 | diff: 143360 | diff/count: 896 | change: 0.41%
count: 170 | rss: 35041280 | diff: 143360 | diff/count: 843 | change: 0.41%
count: 180 | rss: 35041280 | diff: 143360 | diff/count: 796 | change: 0.41%
count: 190 | rss: 35049472 | diff: 151552 | diff/count: 798 | change: 0.43%
count: 200 | rss: 35057664 | diff: 159744 | diff/count: 799 | change: 0.46%
count: 210 | rss: 35057664 | diff: 159744 | diff/count: 761 | change: 0.46%
count: 220 | rss: 35057664 | diff: 159744 | diff/count: 726 | change: 0.46%
count: 230 | rss: 35061760 | diff: 163840 | diff/count: 712 | change: 0.47%
count: 240 | rss: 35098624 | diff: 200704 | diff/count: 836 | change: 0.58%
count: 250 | rss: 35098624 | diff: 200704 | diff/count: 803 | change: 0.58%
count: 260 | rss: 35098624 | diff: 200704 | diff/count: 772 | change: 0.58%

The main difference is, that for Linux the memory leak seems to start at about 100 or 200 connections, while on Windows it's visible immediately.

bsrdjan commented 1 year ago

I re-tested and could not reproduce linear increase on any platform, but here what I believe is the root cause.

When connection is instantiated (connect()), the ABAP system connection parameters (array of strings) are converted to SAP unicode strings. These are stored in dynamically allocated memory: _pyrfc.pyx#L189

When the connection instance is destructed, the allocated memory is released, see free() and __del__() methods: _pyrfc.pyx#L304

In our test script the connection destructor is for some reason never called (cnxn variable in while loop). First I defined it globally (as counter) but that of course did not change anything, destructor as expected not called.

Then I added connection free() method call to the loop and got results again without increase in my system, but with remarkable decrease, starting from count 830 (log below). The garbage collector probably wakes up here.

The log is below and test script with programmatical free() is attached: i298.py.zip Please check if it solves the issue in your system.

3.9.13 (tags/v3.9.13:6de2ca5, May 17 2022, 16:36:42) [MSC v.1929 64 bit (AMD64)]
2.7.1 {'major': 7500, 'minor': 0, 'patchLevel': 11, 'platform': 'win32'}
rss_init: 30330880
count: 10 | rss: 30330880 | diff: 0 | diff/count: 0 | change: 0.0%
count: 20 | rss: 30343168 | diff: 12288 | diff/count: 614 | change: 0.04%
count: 30 | rss: 30343168 | diff: 12288 | diff/count: 410 | change: 0.04%
count: 40 | rss: 30343168 | diff: 12288 | diff/count: 307 | change: 0.04%
count: 50 | rss: 30343168 | diff: 12288 | diff/count: 246 | change: 0.04%
count: 60 | rss: 30343168 | diff: 12288 | diff/count: 205 | change: 0.04%
count: 70 | rss: 30388224 | diff: 57344 | diff/count: 819 | change: 0.19%
count: 80 | rss: 30388224 | diff: 57344 | diff/count: 717 | change: 0.19%
count: 90 | rss: 30388224 | diff: 57344 | diff/count: 637 | change: 0.19%
count: 100 | rss: 30388224 | diff: 57344 | diff/count: 573 | change: 0.19%
count: 110 | rss: 30388224 | diff: 57344 | diff/count: 521 | change: 0.19%
count: 120 | rss: 30363648 | diff: 32768 | diff/count: 273 | change: 0.11%
count: 130 | rss: 30363648 | diff: 32768 | diff/count: 252 | change: 0.11%
count: 140 | rss: 30363648 | diff: 32768 | diff/count: 234 | change: 0.11%
count: 150 | rss: 30363648 | diff: 32768 | diff/count: 218 | change: 0.11%
count: 160 | rss: 30363648 | diff: 32768 | diff/count: 205 | change: 0.11%
count: 170 | rss: 30363648 | diff: 32768 | diff/count: 193 | change: 0.11%
count: 180 | rss: 30363648 | diff: 32768 | diff/count: 182 | change: 0.11%
count: 190 | rss: 30363648 | diff: 32768 | diff/count: 172 | change: 0.11%
count: 200 | rss: 30363648 | diff: 32768 | diff/count: 164 | change: 0.11%
count: 210 | rss: 30363648 | diff: 32768 | diff/count: 156 | change: 0.11%
count: 220 | rss: 30363648 | diff: 32768 | diff/count: 149 | change: 0.11%
count: 230 | rss: 30363648 | diff: 32768 | diff/count: 142 | change: 0.11%
count: 240 | rss: 30363648 | diff: 32768 | diff/count: 137 | change: 0.11%
count: 250 | rss: 30363648 | diff: 32768 | diff/count: 131 | change: 0.11%
count: 260 | rss: 30363648 | diff: 32768 | diff/count: 126 | change: 0.11%
count: 270 | rss: 30343168 | diff: 12288 | diff/count: 46 | change: 0.04%
count: 280 | rss: 30343168 | diff: 12288 | diff/count: 44 | change: 0.04%
count: 290 | rss: 30343168 | diff: 12288 | diff/count: 42 | change: 0.04%
count: 300 | rss: 30343168 | diff: 12288 | diff/count: 41 | change: 0.04%
count: 310 | rss: 30343168 | diff: 12288 | diff/count: 40 | change: 0.04%
count: 320 | rss: 30343168 | diff: 12288 | diff/count: 38 | change: 0.04%
count: 330 | rss: 30343168 | diff: 12288 | diff/count: 37 | change: 0.04%
count: 340 | rss: 30343168 | diff: 12288 | diff/count: 36 | change: 0.04%
count: 350 | rss: 30343168 | diff: 12288 | diff/count: 35 | change: 0.04%
count: 360 | rss: 30343168 | diff: 12288 | diff/count: 34 | change: 0.04%
count: 370 | rss: 30343168 | diff: 12288 | diff/count: 33 | change: 0.04%
count: 380 | rss: 30343168 | diff: 12288 | diff/count: 32 | change: 0.04%
count: 390 | rss: 30343168 | diff: 12288 | diff/count: 32 | change: 0.04%
count: 400 | rss: 30343168 | diff: 12288 | diff/count: 31 | change: 0.04%
count: 410 | rss: 30343168 | diff: 12288 | diff/count: 30 | change: 0.04%
count: 420 | rss: 30343168 | diff: 12288 | diff/count: 29 | change: 0.04%
count: 430 | rss: 30343168 | diff: 12288 | diff/count: 29 | change: 0.04%
count: 440 | rss: 30343168 | diff: 12288 | diff/count: 28 | change: 0.04%
count: 450 | rss: 30343168 | diff: 12288 | diff/count: 27 | change: 0.04%
count: 460 | rss: 30343168 | diff: 12288 | diff/count: 27 | change: 0.04%
count: 470 | rss: 30343168 | diff: 12288 | diff/count: 26 | change: 0.04%
count: 480 | rss: 30343168 | diff: 12288 | diff/count: 26 | change: 0.04%
count: 490 | rss: 30343168 | diff: 12288 | diff/count: 25 | change: 0.04%
count: 500 | rss: 30343168 | diff: 12288 | diff/count: 25 | change: 0.04%
count: 510 | rss: 30343168 | diff: 12288 | diff/count: 24 | change: 0.04%
count: 520 | rss: 30343168 | diff: 12288 | diff/count: 24 | change: 0.04%
count: 530 | rss: 30343168 | diff: 12288 | diff/count: 23 | change: 0.04%
count: 540 | rss: 30343168 | diff: 12288 | diff/count: 23 | change: 0.04%
count: 550 | rss: 30343168 | diff: 12288 | diff/count: 22 | change: 0.04%
count: 560 | rss: 30343168 | diff: 12288 | diff/count: 22 | change: 0.04%
count: 570 | rss: 30343168 | diff: 12288 | diff/count: 22 | change: 0.04%
count: 580 | rss: 30343168 | diff: 12288 | diff/count: 21 | change: 0.04%
count: 590 | rss: 30343168 | diff: 12288 | diff/count: 21 | change: 0.04%
count: 600 | rss: 30343168 | diff: 12288 | diff/count: 20 | change: 0.04%
count: 610 | rss: 30404608 | diff: 73728 | diff/count: 121 | change: 0.24%
count: 620 | rss: 30404608 | diff: 73728 | diff/count: 119 | change: 0.24%
count: 630 | rss: 30404608 | diff: 73728 | diff/count: 117 | change: 0.24%
count: 640 | rss: 30404608 | diff: 73728 | diff/count: 115 | change: 0.24%
count: 650 | rss: 30404608 | diff: 73728 | diff/count: 113 | change: 0.24%
count: 660 | rss: 30404608 | diff: 73728 | diff/count: 112 | change: 0.24%
count: 670 | rss: 30404608 | diff: 73728 | diff/count: 110 | change: 0.24%
count: 680 | rss: 30404608 | diff: 73728 | diff/count: 108 | change: 0.24%
count: 690 | rss: 30404608 | diff: 73728 | diff/count: 107 | change: 0.24%
count: 700 | rss: 30404608 | diff: 73728 | diff/count: 105 | change: 0.24%
count: 710 | rss: 30404608 | diff: 73728 | diff/count: 104 | change: 0.24%
count: 720 | rss: 30404608 | diff: 73728 | diff/count: 102 | change: 0.24%
count: 730 | rss: 30404608 | diff: 73728 | diff/count: 101 | change: 0.24%
count: 740 | rss: 30404608 | diff: 73728 | diff/count: 100 | change: 0.24%
count: 750 | rss: 30404608 | diff: 73728 | diff/count: 98 | change: 0.24%
count: 760 | rss: 30404608 | diff: 73728 | diff/count: 97 | change: 0.24%
count: 770 | rss: 30404608 | diff: 73728 | diff/count: 96 | change: 0.24%
count: 780 | rss: 30404608 | diff: 73728 | diff/count: 95 | change: 0.24%
count: 790 | rss: 30404608 | diff: 73728 | diff/count: 93 | change: 0.24%
count: 800 | rss: 30404608 | diff: 73728 | diff/count: 92 | change: 0.24%
count: 810 | rss: 30404608 | diff: 73728 | diff/count: 91 | change: 0.24%
count: 820 | rss: 30384128 | diff: 53248 | diff/count: 65 | change: 0.18%
count: 830 | rss: 30314496 | diff: -16384 | diff/count: -20 | change: -0.05%
count: 840 | rss: 30322688 | diff: -8192 | diff/count: -10 | change: -0.03%
count: 850 | rss: 30322688 | diff: -8192 | diff/count: -10 | change: -0.03%
count: 860 | rss: 30314496 | diff: -16384 | diff/count: -19 | change: -0.05%
count: 870 | rss: 30298112 | diff: -32768 | diff/count: -38 | change: -0.11%
count: 880 | rss: 30273536 | diff: -57344 | diff/count: -65 | change: -0.19%
count: 890 | rss: 30265344 | diff: -65536 | diff/count: -74 | change: -0.22%
count: 900 | rss: 30248960 | diff: -81920 | diff/count: -91 | change: -0.27%
count: 910 | rss: 30232576 | diff: -98304 | diff/count: -108 | change: -0.32%
count: 920 | rss: 30212096 | diff: -118784 | diff/count: -129 | change: -0.39%
count: 930 | rss: 30228480 | diff: -102400 | diff/count: -110 | change: -0.34%
count: 940 | rss: 30187520 | diff: -143360 | diff/count: -153 | change: -0.47%
count: 950 | rss: 30183424 | diff: -147456 | diff/count: -155 | change: -0.49%
count: 960 | rss: 29290496 | diff: -1040384 | diff/count: -1084 | change: -3.43%
count: 970 | rss: 29282304 | diff: -1048576 | diff/count: -1081 | change: -3.46%
count: 980 | rss: 28225536 | diff: -2105344 | diff/count: -2148 | change: -6.94%
count: 990 | rss: 28237824 | diff: -2093056 | diff/count: -2114 | change: -6.9%
count: 1000 | rss: 27078656 | diff: -3252224 | diff/count: -3252 | change: -10.72%
count: 1010 | rss: 27082752 | diff: -3248128 | diff/count: -3216 | change: -10.71%
count: 1020 | rss: 27066368 | diff: -3264512 | diff/count: -3201 | change: -10.76%
count: 1030 | rss: 25956352 | diff: -4374528 | diff/count: -4247 | change: -14.42%
count: 1040 | rss: 25145344 | diff: -5185536 | diff/count: -4986 | change: -17.1%
count: 1050 | rss: 25161728 | diff: -5169152 | diff/count: -4923 | change: -17.04%
count: 1060 | rss: 23941120 | diff: -6389760 | diff/count: -6028 | change: -21.07%
count: 1070 | rss: 23941120 | diff: -6389760 | diff/count: -5972 | change: -21.07%
count: 1080 | rss: 23924736 | diff: -6406144 | diff/count: -5932 | change: -21.12%
count: 1090 | rss: 23896064 | diff: -6434816 | diff/count: -5904 | change: -21.22%
count: 1100 | rss: 23871488 | diff: -6459392 | diff/count: -5872 | change: -21.3%
count: 1110 | rss: 23855104 | diff: -6475776 | diff/count: -5834 | change: -21.35%
count: 1120 | rss: 23838720 | diff: -6492160 | diff/count: -5797 | change: -21.4%
count: 1130 | rss: 23801856 | diff: -6529024 | diff/count: -5778 | change: -21.53%
count: 1140 | rss: 23810048 | diff: -6520832 | diff/count: -5720 | change: -21.5%
count: 1150 | rss: 23801856 | diff: -6529024 | diff/count: -5677 | change: -21.53%
count: 1160 | rss: 23801856 | diff: -6529024 | diff/count: -5628 | change: -21.53%
count: 1170 | rss: 23801856 | diff: -6529024 | diff/count: -5580 | change: -21.53%
count: 1180 | rss: 23801856 | diff: -6529024 | diff/count: -5533 | change: -21.53%
count: 1190 | rss: 23801856 | diff: -6529024 | diff/count: -5487 | change: -21.53%
count: 1200 | rss: 23801856 | diff: -6529024 | diff/count: -5441 | change: -21.53%
count: 1210 | rss: 23801856 | diff: -6529024 | diff/count: -5396 | change: -21.53%
count: 1220 | rss: 23867392 | diff: -6463488 | diff/count: -5298 | change: -21.31%
count: 1230 | rss: 23867392 | diff: -6463488 | diff/count: -5255 | change: -21.31%
count: 1240 | rss: 23867392 | diff: -6463488 | diff/count: -5212 | change: -21.31%
count: 1250 | rss: 23867392 | diff: -6463488 | diff/count: -5171 | change: -21.31%
count: 1260 | rss: 23867392 | diff: -6463488 | diff/count: -5130 | change: -21.31%
count: 1270 | rss: 23867392 | diff: -6463488 | diff/count: -5089 | change: -21.31%
count: 1280 | rss: 23867392 | diff: -6463488 | diff/count: -5050 | change: -21.31%
count: 1290 | rss: 23867392 | diff: -6463488 | diff/count: -5010 | change: -21.31%
count: 1300 | rss: 23867392 | diff: -6463488 | diff/count: -4972 | change: -21.31%
count: 1310 | rss: 23867392 | diff: -6463488 | diff/count: -4934 | change: -21.31%
count: 1320 | rss: 23867392 | diff: -6463488 | diff/count: -4897 | change: -21.31%
count: 1330 | rss: 23867392 | diff: -6463488 | diff/count: -4860 | change: -21.31%
count: 1340 | rss: 23867392 | diff: -6463488 | diff/count: -4823 | change: -21.31%
count: 1350 | rss: 23851008 | diff: -6479872 | diff/count: -4800 | change: -21.36%
count: 1360 | rss: 23851008 | diff: -6479872 | diff/count: -4765 | change: -21.36%
count: 1370 | rss: 23851008 | diff: -6479872 | diff/count: -4730 | change: -21.36%
count: 1380 | rss: 23851008 | diff: -6479872 | diff/count: -4696 | change: -21.36%
count: 1390 | rss: 23851008 | diff: -6479872 | diff/count: -4662 | change: -21.36%
count: 1400 | rss: 23851008 | diff: -6479872 | diff/count: -4628 | change: -21.36%
count: 1410 | rss: 23851008 | diff: -6479872 | diff/count: -4596 | change: -21.36%
count: 1420 | rss: 23851008 | diff: -6479872 | diff/count: -4563 | change: -21.36%
count: 1430 | rss: 23851008 | diff: -6479872 | diff/count: -4531 | change: -21.36%
count: 1440 | rss: 23851008 | diff: -6479872 | diff/count: -4500 | change: -21.36%
count: 1450 | rss: 23851008 | diff: -6479872 | diff/count: -4469 | change: -21.36%
count: 1460 | rss: 23851008 | diff: -6479872 | diff/count: -4438 | change: -21.36%
count: 1470 | rss: 23851008 | diff: -6479872 | diff/count: -4408 | change: -21.36%
count: 1480 | rss: 23851008 | diff: -6479872 | diff/count: -4378 | change: -21.36%
count: 1490 | rss: 23851008 | diff: -6479872 | diff/count: -4349 | change: -21.36%
count: 1500 | rss: 23851008 | diff: -6479872 | diff/count: -4320 | change: -21.36%
count: 1510 | rss: 23851008 | diff: -6479872 | diff/count: -4291 | change: -21.36%
count: 1520 | rss: 23851008 | diff: -6479872 | diff/count: -4263 | change: -21.36%
count: 1530 | rss: 23851008 | diff: -6479872 | diff/count: -4235 | change: -21.36%
count: 1540 | rss: 23851008 | diff: -6479872 | diff/count: -4208 | change: -21.36%
count: 1550 | rss: 23851008 | diff: -6479872 | diff/count: -4181 | change: -21.36%
count: 1560 | rss: 23851008 | diff: -6479872 | diff/count: -4154 | change: -21.36%
count: 1570 | rss: 23851008 | diff: -6479872 | diff/count: -4127 | change: -21.36%
count: 1580 | rss: 23851008 | diff: -6479872 | diff/count: -4101 | change: -21.36%
count: 1590 | rss: 23851008 | diff: -6479872 | diff/count: -4075 | change: -21.36%
count: 1600 | rss: 23851008 | diff: -6479872 | diff/count: -4050 | change: -21.36%
count: 1610 | rss: 23851008 | diff: -6479872 | diff/count: -4025 | change: -21.36%
count: 1620 | rss: 23851008 | diff: -6479872 | diff/count: -4000 | change: -21.36%
count: 1630 | rss: 23851008 | diff: -6479872 | diff/count: -3975 | change: -21.36%
count: 1640 | rss: 23851008 | diff: -6479872 | diff/count: -3951 | change: -21.36%
count: 1650 | rss: 23851008 | diff: -6479872 | diff/count: -3927 | change: -21.36%
count: 1660 | rss: 23851008 | diff: -6479872 | diff/count: -3904 | change: -21.36%
count: 1670 | rss: 23851008 | diff: -6479872 | diff/count: -3880 | change: -21.36%
count: 1680 | rss: 23851008 | diff: -6479872 | diff/count: -3857 | change: -21.36%
count: 1690 | rss: 23851008 | diff: -6479872 | diff/count: -3834 | change: -21.36%
count: 1700 | rss: 23851008 | diff: -6479872 | diff/count: -3812 | change: -21.36%
count: 1710 | rss: 23851008 | diff: -6479872 | diff/count: -3789 | change: -21.36%
count: 1720 | rss: 23851008 | diff: -6479872 | diff/count: -3767 | change: -21.36%
count: 1730 | rss: 23851008 | diff: -6479872 | diff/count: -3746 | change: -21.36%
count: 1740 | rss: 23851008 | diff: -6479872 | diff/count: -3724 | change: -21.36%
count: 1750 | rss: 23851008 | diff: -6479872 | diff/count: -3703 | change: -21.36%
count: 1760 | rss: 23851008 | diff: -6479872 | diff/count: -3682 | change: -21.36%
count: 1770 | rss: 23851008 | diff: -6479872 | diff/count: -3661 | change: -21.36%
count: 1780 | rss: 23851008 | diff: -6479872 | diff/count: -3640 | change: -21.36%
count: 1790 | rss: 23851008 | diff: -6479872 | diff/count: -3620 | change: -21.36%
count: 1800 | rss: 23851008 | diff: -6479872 | diff/count: -3600 | change: -21.36%
count: 1810 | rss: 23851008 | diff: -6479872 | diff/count: -3580 | change: -21.36%
count: 1820 | rss: 23842816 | diff: -6488064 | diff/count: -3565 | change: -21.39%
count: 1830 | rss: 23842816 | diff: -6488064 | diff/count: -3545 | change: -21.39%
count: 1840 | rss: 23846912 | diff: -6483968 | diff/count: -3524 | change: -21.38%
count: 1850 | rss: 23846912 | diff: -6483968 | diff/count: -3505 | change: -21.38%
count: 1860 | rss: 23838720 | diff: -6492160 | diff/count: -3490 | change: -21.4%
count: 1870 | rss: 23842816 | diff: -6488064 | diff/count: -3470 | change: -21.39%
count: 1880 | rss: 23838720 | diff: -6492160 | diff/count: -3453 | change: -21.4%
count: 1890 | rss: 23838720 | diff: -6492160 | diff/count: -3435 | change: -21.4%
count: 1900 | rss: 23826432 | diff: -6504448 | diff/count: -3423 | change: -21.44%
count: 1910 | rss: 23822336 | diff: -6508544 | diff/count: -3408 | change: -21.46%
count: 1920 | rss: 23805952 | diff: -6524928 | diff/count: -3398 | change: -21.51%
count: 1930 | rss: 23744512 | diff: -6586368 | diff/count: -3413 | change: -21.72%
count: 1940 | rss: 23719936 | diff: -6610944 | diff/count: -3408 | change: -21.8%
count: 1950 | rss: 23678976 | diff: -6651904 | diff/count: -3411 | change: -21.93%
count: 1960 | rss: 23654400 | diff: -6676480 | diff/count: -3406 | change: -22.01%
count: 1970 | rss: 23592960 | diff: -6737920 | diff/count: -3420 | change: -22.21%
count: 1980 | rss: 23556096 | diff: -6774784 | diff/count: -3422 | change: -22.34%
count: 1990 | rss: 23523328 | diff: -6807552 | diff/count: -3421 | change: -22.44%
count: 2000 | rss: 23461888 | diff: -6868992 | diff/count: -3434 | change: -22.65%
count: 2010 | rss: 23384064 | diff: -6946816 | diff/count: -3456 | change: -22.9%
count: 2020 | rss: 23400448 | diff: -6930432 | diff/count: -3431 | change: -22.85%
count: 2030 | rss: 23302144 | diff: -7028736 | diff/count: -3462 | change: -23.17%
count: 2040 | rss: 23244800 | diff: -7086080 | diff/count: -3474 | change: -23.36%
count: 2050 | rss: 23257088 | diff: -7073792 | diff/count: -3451 | change: -23.32%
count: 2060 | rss: 23220224 | diff: -7110656 | diff/count: -3452 | change: -23.44%
count: 2070 | rss: 23171072 | diff: -7159808 | diff/count: -3459 | change: -23.61%
count: 2080 | rss: 23060480 | diff: -7270400 | diff/count: -3495 | change: -23.97%
count: 2090 | rss: 23035904 | diff: -7294976 | diff/count: -3490 | change: -24.05%
count: 2100 | rss: 22990848 | diff: -7340032 | diff/count: -3495 | change: -24.2%
count: 2110 | rss: 22941696 | diff: -7389184 | diff/count: -3502 | change: -24.36%
count: 2120 | rss: 22818816 | diff: -7512064 | diff/count: -3543 | change: -24.77%
count: 2130 | rss: 22716416 | diff: -7614464 | diff/count: -3575 | change: -25.1%
count: 2140 | rss: 22634496 | diff: -7696384 | diff/count: -3596 | change: -25.37%
count: 2150 | rss: 22589440 | diff: -7741440 | diff/count: -3601 | change: -25.52%
count: 2160 | rss: 22552576 | diff: -7778304 | diff/count: -3601 | change: -25.64%
count: 2170 | rss: 22433792 | diff: -7897088 | diff/count: -3639 | change: -26.04%
count: 2180 | rss: 22368256 | diff: -7962624 | diff/count: -3653 | change: -26.25%
count: 2190 | rss: 22310912 | diff: -8019968 | diff/count: -3662 | change: -26.44%
count: 2200 | rss: 22224896 | diff: -8105984 | diff/count: -3685 | change: -26.73%
count: 2210 | rss: 22147072 | diff: -8183808 | diff/count: -3703 | change: -26.98%
count: 2220 | rss: 22065152 | diff: -8265728 | diff/count: -3723 | change: -27.25%
count: 2230 | rss: 22007808 | diff: -8323072 | diff/count: -3732 | change: -27.44%
count: 2240 | rss: 21950464 | diff: -8380416 | diff/count: -3741 | change: -27.63%
count: 2250 | rss: 21917696 | diff: -8413184 | diff/count: -3739 | change: -27.74%
count: 2260 | rss: 21716992 | diff: -8613888 | diff/count: -3811 | change: -28.4%
count: 2270 | rss: 21676032 | diff: -8654848 | diff/count: -3813 | change: -28.53%
count: 2280 | rss: 21360640 | diff: -8970240 | diff/count: -3934 | change: -29.57%
count: 2290 | rss: 21340160 | diff: -8990720 | diff/count: -3926 | change: -29.64%
count: 2300 | rss: 21274624 | diff: -9056256 | diff/count: -3938 | change: -29.86%
count: 2310 | rss: 21200896 | diff: -9129984 | diff/count: -3952 | change: -30.1%
count: 2320 | rss: 21172224 | diff: -9158656 | diff/count: -3948 | change: -30.2%
count: 2330 | rss: 21131264 | diff: -9199616 | diff/count: -3948 | change: -30.33%
count: 2340 | rss: 21078016 | diff: -9252864 | diff/count: -3954 | change: -30.51%
count: 2350 | rss: 21024768 | diff: -9306112 | diff/count: -3960 | change: -30.68%
count: 2360 | rss: 20955136 | diff: -9375744 | diff/count: -3973 | change: -30.91%
count: 2370 | rss: 20905984 | diff: -9424896 | diff/count: -3977 | change: -31.07%
count: 2380 | rss: 20824064 | diff: -9506816 | diff/count: -3994 | change: -31.34%
count: 2390 | rss: 20758528 | diff: -9572352 | diff/count: -4005 | change: -31.56%
count: 2400 | rss: 20680704 | diff: -9650176 | diff/count: -4021 | change: -31.82%
count: 2410 | rss: 20586496 | diff: -9744384 | diff/count: -4043 | change: -32.13%
count: 2420 | rss: 20111360 | diff: -10219520 | diff/count: -4223 | change: -33.69%
count: 2430 | rss: 19775488 | diff: -10555392 | diff/count: -4344 | change: -34.8%
count: 2440 | rss: 19730432 | diff: -10600448 | diff/count: -4344 | change: -34.95%
count: 2450 | rss: 19685376 | diff: -10645504 | diff/count: -4345 | change: -35.1%
count: 2460 | rss: 19644416 | diff: -10686464 | diff/count: -4344 | change: -35.23%
count: 2470 | rss: 19582976 | diff: -10747904 | diff/count: -4351 | change: -35.44%
count: 2480 | rss: 19501056 | diff: -10829824 | diff/count: -4367 | change: -35.71%
count: 2490 | rss: 19394560 | diff: -10936320 | diff/count: -4392 | change: -36.06%
count: 2500 | rss: 19247104 | diff: -11083776 | diff/count: -4434 | change: -36.54%
count: 2510 | rss: 18825216 | diff: -11505664 | diff/count: -4584 | change: -37.93%
count: 2520 | rss: 18305024 | diff: -12025856 | diff/count: -4772 | change: -39.65%
count: 2530 | rss: 17874944 | diff: -12455936 | diff/count: -4923 | change: -41.07%
mpf82 commented 1 year ago

Calling free() does indeed seem to have an effect:

3.11.1 (tags/v3.11.1:a7a450f, Dec  6 2022, 19:58:39) [MSC v.1934 64 bit (AMD64)]
2.7.0 {'major': 7500, 'minor': 0, 'patchLevel': 11, 'platform': 'win32'}
rss_init: 35098624
count: 10 | rss: 35098624 | diff: 0 | diff/count: 0 | change: 0.0%
count: 20 | rss: 35131392 | diff: 32768 | diff/count: 1638 | change: 0.09%
count: 30 | rss: 35151872 | diff: 53248 | diff/count: 1775 | change: 0.15%
count: 40 | rss: 35172352 | diff: 73728 | diff/count: 1843 | change: 0.21%
count: 50 | rss: 35192832 | diff: 94208 | diff/count: 1884 | change: 0.27%
count: 60 | rss: 35213312 | diff: 114688 | diff/count: 1911 | change: 0.33%
count: 70 | rss: 35217408 | diff: 118784 | diff/count: 1697 | change: 0.34%
count: 80 | rss: 35217408 | diff: 118784 | diff/count: 1485 | change: 0.34%
count: 90 | rss: 35217408 | diff: 118784 | diff/count: 1320 | change: 0.34%
count: 100 | rss: 35217408 | diff: 118784 | diff/count: 1188 | change: 0.34%
count: 110 | rss: 35217408 | diff: 118784 | diff/count: 1080 | change: 0.34%
count: 120 | rss: 35217408 | diff: 118784 | diff/count: 990 | change: 0.34%
count: 130 | rss: 35217408 | diff: 118784 | diff/count: 914 | change: 0.34%
count: 140 | rss: 35217408 | diff: 118784 | diff/count: 848 | change: 0.34%
count: 150 | rss: 35217408 | diff: 118784 | diff/count: 792 | change: 0.34%
count: 160 | rss: 35188736 | diff: 90112 | diff/count: 563 | change: 0.26%
count: 170 | rss: 35188736 | diff: 90112 | diff/count: 530 | change: 0.26%
count: 180 | rss: 35188736 | diff: 90112 | diff/count: 501 | change: 0.26%
count: 190 | rss: 35188736 | diff: 90112 | diff/count: 474 | change: 0.26%
count: 200 | rss: 35188736 | diff: 90112 | diff/count: 451 | change: 0.26%
count: 210 | rss: 35188736 | diff: 90112 | diff/count: 429 | change: 0.26%
count: 220 | rss: 35188736 | diff: 90112 | diff/count: 410 | change: 0.26%
count: 230 | rss: 35188736 | diff: 90112 | diff/count: 392 | change: 0.26%
count: 240 | rss: 35188736 | diff: 90112 | diff/count: 375 | change: 0.26%
count: 250 | rss: 35188736 | diff: 90112 | diff/count: 360 | change: 0.26%
count: 260 | rss: 35188736 | diff: 90112 | diff/count: 347 | change: 0.26%
count: 270 | rss: 35188736 | diff: 90112 | diff/count: 334 | change: 0.26%
count: 280 | rss: 35188736 | diff: 90112 | diff/count: 322 | change: 0.26%
count: 290 | rss: 35188736 | diff: 90112 | diff/count: 311 | change: 0.26%
count: 300 | rss: 35188736 | diff: 90112 | diff/count: 300 | change: 0.26%
count: 310 | rss: 35188736 | diff: 90112 | diff/count: 291 | change: 0.26%
count: 320 | rss: 35188736 | diff: 90112 | diff/count: 282 | change: 0.26%
count: 330 | rss: 35254272 | diff: 155648 | diff/count: 472 | change: 0.44%
count: 340 | rss: 35254272 | diff: 155648 | diff/count: 458 | change: 0.44%
count: 350 | rss: 35254272 | diff: 155648 | diff/count: 445 | change: 0.44%
count: 360 | rss: 35254272 | diff: 155648 | diff/count: 432 | change: 0.44%
count: 370 | rss: 35254272 | diff: 155648 | diff/count: 421 | change: 0.44%
count: 380 | rss: 35254272 | diff: 155648 | diff/count: 410 | change: 0.44%
count: 390 | rss: 35254272 | diff: 155648 | diff/count: 399 | change: 0.44%
count: 400 | rss: 35254272 | diff: 155648 | diff/count: 389 | change: 0.44%
count: 410 | rss: 35254272 | diff: 155648 | diff/count: 380 | change: 0.44%
count: 420 | rss: 35254272 | diff: 155648 | diff/count: 371 | change: 0.44%
count: 430 | rss: 35254272 | diff: 155648 | diff/count: 362 | change: 0.44%
count: 440 | rss: 35254272 | diff: 155648 | diff/count: 354 | change: 0.44%
count: 450 | rss: 35233792 | diff: 135168 | diff/count: 300 | change: 0.39%
count: 460 | rss: 35233792 | diff: 135168 | diff/count: 294 | change: 0.39%
count: 470 | rss: 35233792 | diff: 135168 | diff/count: 288 | change: 0.39%
count: 480 | rss: 35233792 | diff: 135168 | diff/count: 282 | change: 0.39%
count: 490 | rss: 35233792 | diff: 135168 | diff/count: 276 | change: 0.39%
count: 500 | rss: 35233792 | diff: 135168 | diff/count: 270 | change: 0.39%
count: 510 | rss: 35233792 | diff: 135168 | diff/count: 265 | change: 0.39%
count: 520 | rss: 35233792 | diff: 135168 | diff/count: 260 | change: 0.39%
count: 530 | rss: 35233792 | diff: 135168 | diff/count: 255 | change: 0.39%
count: 540 | rss: 35233792 | diff: 135168 | diff/count: 250 | change: 0.39%
count: 550 | rss: 35233792 | diff: 135168 | diff/count: 246 | change: 0.39%
count: 560 | rss: 35233792 | diff: 135168 | diff/count: 241 | change: 0.39%
count: 570 | rss: 35233792 | diff: 135168 | diff/count: 237 | change: 0.39%
count: 580 | rss: 35233792 | diff: 135168 | diff/count: 233 | change: 0.39%
count: 590 | rss: 35233792 | diff: 135168 | diff/count: 229 | change: 0.39%
count: 600 | rss: 35233792 | diff: 135168 | diff/count: 225 | change: 0.39%
count: 610 | rss: 35233792 | diff: 135168 | diff/count: 222 | change: 0.39%
count: 620 | rss: 35233792 | diff: 135168 | diff/count: 218 | change: 0.39%
count: 630 | rss: 35233792 | diff: 135168 | diff/count: 215 | change: 0.39%
count: 640 | rss: 35233792 | diff: 135168 | diff/count: 211 | change: 0.39%
count: 650 | rss: 35282944 | diff: 184320 | diff/count: 284 | change: 0.53%
count: 660 | rss: 35282944 | diff: 184320 | diff/count: 279 | change: 0.53%
count: 670 | rss: 35282944 | diff: 184320 | diff/count: 275 | change: 0.53%
count: 680 | rss: 35282944 | diff: 184320 | diff/count: 271 | change: 0.53%
count: 690 | rss: 35282944 | diff: 184320 | diff/count: 267 | change: 0.53%
count: 700 | rss: 35282944 | diff: 184320 | diff/count: 263 | change: 0.53%
count: 710 | rss: 35282944 | diff: 184320 | diff/count: 260 | change: 0.53%
count: 720 | rss: 35241984 | diff: 143360 | diff/count: 199 | change: 0.41%
count: 730 | rss: 35241984 | diff: 143360 | diff/count: 196 | change: 0.41%
count: 740 | rss: 35241984 | diff: 143360 | diff/count: 194 | change: 0.41%
count: 750 | rss: 35241984 | diff: 143360 | diff/count: 191 | change: 0.41%
count: 760 | rss: 35241984 | diff: 143360 | diff/count: 189 | change: 0.41%
count: 770 | rss: 35241984 | diff: 143360 | diff/count: 186 | change: 0.41%
count: 780 | rss: 35241984 | diff: 143360 | diff/count: 184 | change: 0.41%
count: 790 | rss: 35241984 | diff: 143360 | diff/count: 181 | change: 0.41%
count: 800 | rss: 35241984 | diff: 143360 | diff/count: 179 | change: 0.41%
count: 810 | rss: 35241984 | diff: 143360 | diff/count: 177 | change: 0.41%
count: 820 | rss: 35241984 | diff: 143360 | diff/count: 175 | change: 0.41%
count: 830 | rss: 35241984 | diff: 143360 | diff/count: 173 | change: 0.41%
count: 840 | rss: 35241984 | diff: 143360 | diff/count: 171 | change: 0.41%
count: 850 | rss: 35241984 | diff: 143360 | diff/count: 169 | change: 0.41%
count: 860 | rss: 35241984 | diff: 143360 | diff/count: 167 | change: 0.41%
count: 870 | rss: 35241984 | diff: 143360 | diff/count: 165 | change: 0.41%
count: 880 | rss: 35241984 | diff: 143360 | diff/count: 163 | change: 0.41%
count: 890 | rss: 35241984 | diff: 143360 | diff/count: 161 | change: 0.41%
count: 900 | rss: 35241984 | diff: 143360 | diff/count: 159 | change: 0.41%
count: 910 | rss: 35241984 | diff: 143360 | diff/count: 158 | change: 0.41%
count: 920 | rss: 35241984 | diff: 143360 | diff/count: 156 | change: 0.41%
count: 930 | rss: 35241984 | diff: 143360 | diff/count: 154 | change: 0.41%
count: 940 | rss: 35241984 | diff: 143360 | diff/count: 153 | change: 0.41%
count: 950 | rss: 35262464 | diff: 163840 | diff/count: 172 | change: 0.47%
count: 960 | rss: 35262464 | diff: 163840 | diff/count: 171 | change: 0.47%
count: 970 | rss: 35262464 | diff: 163840 | diff/count: 169 | change: 0.47%
count: 980 | rss: 35262464 | diff: 163840 | diff/count: 167 | change: 0.47%
count: 990 | rss: 35262464 | diff: 163840 | diff/count: 165 | change: 0.47%
count: 1000 | rss: 35262464 | diff: 163840 | diff/count: 164 | change: 0.47%
count: 1010 | rss: 35262464 | diff: 163840 | diff/count: 162 | change: 0.47%
count: 1020 | rss: 35262464 | diff: 163840 | diff/count: 161 | change: 0.47%
count: 1030 | rss: 35262464 | diff: 163840 | diff/count: 159 | change: 0.47%
count: 1040 | rss: 35262464 | diff: 163840 | diff/count: 158 | change: 0.47%
count: 1050 | rss: 35262464 | diff: 163840 | diff/count: 156 | change: 0.47%
count: 1060 | rss: 35241984 | diff: 143360 | diff/count: 135 | change: 0.41%
count: 1070 | rss: 35241984 | diff: 143360 | diff/count: 134 | change: 0.41%
count: 1080 | rss: 35241984 | diff: 143360 | diff/count: 133 | change: 0.41%
count: 1090 | rss: 35241984 | diff: 143360 | diff/count: 132 | change: 0.41%
count: 1100 | rss: 35241984 | diff: 143360 | diff/count: 130 | change: 0.41%
count: 1110 | rss: 35241984 | diff: 143360 | diff/count: 129 | change: 0.41%
count: 1120 | rss: 35241984 | diff: 143360 | diff/count: 128 | change: 0.41%
count: 1130 | rss: 35241984 | diff: 143360 | diff/count: 127 | change: 0.41%
count: 1140 | rss: 35241984 | diff: 143360 | diff/count: 126 | change: 0.41%
count: 1150 | rss: 35241984 | diff: 143360 | diff/count: 125 | change: 0.41%
count: 1160 | rss: 35241984 | diff: 143360 | diff/count: 124 | change: 0.41%
count: 1170 | rss: 35241984 | diff: 143360 | diff/count: 123 | change: 0.41%
count: 1180 | rss: 35241984 | diff: 143360 | diff/count: 121 | change: 0.41%
count: 1190 | rss: 35241984 | diff: 143360 | diff/count: 120 | change: 0.41%
count: 1200 | rss: 35241984 | diff: 143360 | diff/count: 119 | change: 0.41%
count: 1210 | rss: 35241984 | diff: 143360 | diff/count: 118 | change: 0.41%
count: 1220 | rss: 35241984 | diff: 143360 | diff/count: 118 | change: 0.41%
count: 1230 | rss: 35241984 | diff: 143360 | diff/count: 117 | change: 0.41%
count: 1240 | rss: 35241984 | diff: 143360 | diff/count: 116 | change: 0.41%
count: 1250 | rss: 35241984 | diff: 143360 | diff/count: 115 | change: 0.41%
count: 1260 | rss: 35241984 | diff: 143360 | diff/count: 114 | change: 0.41%
count: 1270 | rss: 35262464 | diff: 163840 | diff/count: 129 | change: 0.47%
count: 1280 | rss: 35262464 | diff: 163840 | diff/count: 128 | change: 0.47%
count: 1290 | rss: 35262464 | diff: 163840 | diff/count: 127 | change: 0.47%
count: 1300 | rss: 35262464 | diff: 163840 | diff/count: 126 | change: 0.47%
count: 1310 | rss: 35262464 | diff: 163840 | diff/count: 125 | change: 0.47%
count: 1320 | rss: 35262464 | diff: 163840 | diff/count: 124 | change: 0.47%
count: 1330 | rss: 35262464 | diff: 163840 | diff/count: 123 | change: 0.47%
count: 1340 | rss: 35262464 | diff: 163840 | diff/count: 122 | change: 0.47%
count: 1350 | rss: 35241984 | diff: 143360 | diff/count: 106 | change: 0.41%
count: 1360 | rss: 35241984 | diff: 143360 | diff/count: 105 | change: 0.41%
count: 1370 | rss: 35241984 | diff: 143360 | diff/count: 105 | change: 0.41%
count: 1380 | rss: 35241984 | diff: 143360 | diff/count: 104 | change: 0.41%
count: 1390 | rss: 35241984 | diff: 143360 | diff/count: 103 | change: 0.41%
count: 1400 | rss: 35241984 | diff: 143360 | diff/count: 102 | change: 0.41%
count: 1410 | rss: 35241984 | diff: 143360 | diff/count: 102 | change: 0.41%
count: 1420 | rss: 35241984 | diff: 143360 | diff/count: 101 | change: 0.41%
count: 1430 | rss: 35241984 | diff: 143360 | diff/count: 100 | change: 0.41%
count: 1440 | rss: 35241984 | diff: 143360 | diff/count: 100 | change: 0.41%
count: 1450 | rss: 35241984 | diff: 143360 | diff/count: 99 | change: 0.41%
count: 1460 | rss: 35241984 | diff: 143360 | diff/count: 98 | change: 0.41%
count: 1470 | rss: 35241984 | diff: 143360 | diff/count: 98 | change: 0.41%
count: 1480 | rss: 35241984 | diff: 143360 | diff/count: 97 | change: 0.41%
count: 1490 | rss: 35241984 | diff: 143360 | diff/count: 96 | change: 0.41%
count: 1500 | rss: 35241984 | diff: 143360 | diff/count: 96 | change: 0.41%
count: 1510 | rss: 35241984 | diff: 143360 | diff/count: 95 | change: 0.41%
count: 1520 | rss: 35241984 | diff: 143360 | diff/count: 94 | change: 0.41%
count: 1530 | rss: 35241984 | diff: 143360 | diff/count: 94 | change: 0.41%
count: 1540 | rss: 35241984 | diff: 143360 | diff/count: 93 | change: 0.41%
count: 1550 | rss: 35241984 | diff: 143360 | diff/count: 92 | change: 0.41%
count: 1560 | rss: 35241984 | diff: 143360 | diff/count: 92 | change: 0.41%
count: 1570 | rss: 35241984 | diff: 143360 | diff/count: 91 | change: 0.41%
count: 1580 | rss: 35241984 | diff: 143360 | diff/count: 91 | change: 0.41%
count: 1590 | rss: 35241984 | diff: 143360 | diff/count: 90 | change: 0.41%
count: 1600 | rss: 35241984 | diff: 143360 | diff/count: 90 | change: 0.41%
count: 1610 | rss: 35241984 | diff: 143360 | diff/count: 89 | change: 0.41%
count: 1620 | rss: 35262464 | diff: 163840 | diff/count: 101 | change: 0.47%
count: 1630 | rss: 35262464 | diff: 163840 | diff/count: 101 | change: 0.47%
count: 1640 | rss: 35262464 | diff: 163840 | diff/count: 100 | change: 0.47%
count: 1650 | rss: 35262464 | diff: 163840 | diff/count: 99 | change: 0.47%
count: 1660 | rss: 35262464 | diff: 163840 | diff/count: 99 | change: 0.47%
count: 1670 | rss: 35262464 | diff: 163840 | diff/count: 98 | change: 0.47%
count: 1680 | rss: 35262464 | diff: 163840 | diff/count: 98 | change: 0.47%
count: 1690 | rss: 35262464 | diff: 163840 | diff/count: 97 | change: 0.47%
count: 1700 | rss: 35262464 | diff: 163840 | diff/count: 96 | change: 0.47%
count: 1710 | rss: 35262464 | diff: 163840 | diff/count: 96 | change: 0.47%
count: 1720 | rss: 35262464 | diff: 163840 | diff/count: 95 | change: 0.47%
count: 1730 | rss: 35262464 | diff: 163840 | diff/count: 95 | change: 0.47%
count: 1740 | rss: 35241984 | diff: 143360 | diff/count: 82 | change: 0.41%
count: 1750 | rss: 35241984 | diff: 143360 | diff/count: 82 | change: 0.41%
count: 1760 | rss: 35241984 | diff: 143360 | diff/count: 81 | change: 0.41%
count: 1770 | rss: 35241984 | diff: 143360 | diff/count: 81 | change: 0.41%
count: 1780 | rss: 35241984 | diff: 143360 | diff/count: 81 | change: 0.41%
count: 1790 | rss: 35241984 | diff: 143360 | diff/count: 80 | change: 0.41%
count: 1800 | rss: 35241984 | diff: 143360 | diff/count: 80 | change: 0.41%
count: 1810 | rss: 35241984 | diff: 143360 | diff/count: 79 | change: 0.41%
count: 1820 | rss: 35241984 | diff: 143360 | diff/count: 79 | change: 0.41%
count: 1830 | rss: 35241984 | diff: 143360 | diff/count: 78 | change: 0.41%
count: 1840 | rss: 35241984 | diff: 143360 | diff/count: 78 | change: 0.41%
count: 1850 | rss: 35241984 | diff: 143360 | diff/count: 77 | change: 0.41%
count: 1860 | rss: 35241984 | diff: 143360 | diff/count: 77 | change: 0.41%
count: 1870 | rss: 35241984 | diff: 143360 | diff/count: 77 | change: 0.41%
count: 1880 | rss: 35241984 | diff: 143360 | diff/count: 76 | change: 0.41%
count: 1890 | rss: 35241984 | diff: 143360 | diff/count: 76 | change: 0.41%
count: 1900 | rss: 35241984 | diff: 143360 | diff/count: 75 | change: 0.41%
count: 1910 | rss: 35241984 | diff: 143360 | diff/count: 75 | change: 0.41%
count: 1920 | rss: 35241984 | diff: 143360 | diff/count: 75 | change: 0.41%
count: 1930 | rss: 35241984 | diff: 143360 | diff/count: 74 | change: 0.41%
count: 1940 | rss: 35262464 | diff: 163840 | diff/count: 84 | change: 0.47%
count: 1950 | rss: 35262464 | diff: 163840 | diff/count: 84 | change: 0.47%
count: 1960 | rss: 35262464 | diff: 163840 | diff/count: 84 | change: 0.47%
count: 1970 | rss: 35262464 | diff: 163840 | diff/count: 83 | change: 0.47%
count: 1980 | rss: 35262464 | diff: 163840 | diff/count: 83 | change: 0.47%
count: 1990 | rss: 35262464 | diff: 163840 | diff/count: 82 | change: 0.47%
count: 2000 | rss: 35262464 | diff: 163840 | diff/count: 82 | change: 0.47%
count: 2010 | rss: 35262464 | diff: 163840 | diff/count: 82 | change: 0.47%
count: 2020 | rss: 35241984 | diff: 143360 | diff/count: 71 | change: 0.41%
count: 2030 | rss: 35241984 | diff: 143360 | diff/count: 71 | change: 0.41%
count: 2040 | rss: 35241984 | diff: 143360 | diff/count: 70 | change: 0.41%
count: 2050 | rss: 35266560 | diff: 167936 | diff/count: 82 | change: 0.48%
count: 2060 | rss: 35266560 | diff: 167936 | diff/count: 82 | change: 0.48%
count: 2070 | rss: 35266560 | diff: 167936 | diff/count: 81 | change: 0.48%
count: 2080 | rss: 24018944 | diff: -11079680 | diff/count: -5327 | change: -31.57%
count: 2090 | rss: 24023040 | diff: -11075584 | diff/count: -5299 | change: -31.56%
count: 2100 | rss: 24023040 | diff: -11075584 | diff/count: -5274 | change: -31.56%
count: 2110 | rss: 24023040 | diff: -11075584 | diff/count: -5249 | change: -31.56%
count: 2120 | rss: 24023040 | diff: -11075584 | diff/count: -5224 | change: -31.56%
count: 2130 | rss: 24023040 | diff: -11075584 | diff/count: -5200 | change: -31.56%
count: 2140 | rss: 24023040 | diff: -11075584 | diff/count: -5176 | change: -31.56%
count: 2150 | rss: 24023040 | diff: -11075584 | diff/count: -5151 | change: -31.56%
count: 2160 | rss: 24023040 | diff: -11075584 | diff/count: -5128 | change: -31.56%
count: 2170 | rss: 24023040 | diff: -11075584 | diff/count: -5104 | change: -31.56%
count: 2180 | rss: 24023040 | diff: -11075584 | diff/count: -5081 | change: -31.56%
count: 2190 | rss: 24023040 | diff: -11075584 | diff/count: -5057 | change: -31.56%
count: 2200 | rss: 24023040 | diff: -11075584 | diff/count: -5034 | change: -31.56%
count: 2210 | rss: 24023040 | diff: -11075584 | diff/count: -5012 | change: -31.56%
count: 2220 | rss: 24023040 | diff: -11075584 | diff/count: -4989 | change: -31.56%
count: 2230 | rss: 24023040 | diff: -11075584 | diff/count: -4967 | change: -31.56%
count: 2240 | rss: 24023040 | diff: -11075584 | diff/count: -4944 | change: -31.56%
count: 2250 | rss: 24023040 | diff: -11075584 | diff/count: -4922 | change: -31.56%
count: 2260 | rss: 24023040 | diff: -11075584 | diff/count: -4901 | change: -31.56%
count: 2270 | rss: 24023040 | diff: -11075584 | diff/count: -4879 | change: -31.56%
count: 2280 | rss: 24043520 | diff: -11055104 | diff/count: -4849 | change: -31.5%
count: 2290 | rss: 24043520 | diff: -11055104 | diff/count: -4828 | change: -31.5%
count: 2300 | rss: 24043520 | diff: -11055104 | diff/count: -4807 | change: -31.5%
count: 2310 | rss: 24043520 | diff: -11055104 | diff/count: -4786 | change: -31.5%
count: 2320 | rss: 24043520 | diff: -11055104 | diff/count: -4765 | change: -31.5%
count: 2330 | rss: 24043520 | diff: -11055104 | diff/count: -4745 | change: -31.5%
count: 2340 | rss: 24043520 | diff: -11055104 | diff/count: -4724 | change: -31.5%
count: 2350 | rss: 24043520 | diff: -11055104 | diff/count: -4704 | change: -31.5%
count: 2360 | rss: 24043520 | diff: -11055104 | diff/count: -4684 | change: -31.5%
count: 2370 | rss: 24043520 | diff: -11055104 | diff/count: -4665 | change: -31.5%
count: 2380 | rss: 24043520 | diff: -11055104 | diff/count: -4645 | change: -31.5%
count: 2390 | rss: 24043520 | diff: -11055104 | diff/count: -4626 | change: -31.5%
count: 2400 | rss: 24043520 | diff: -11055104 | diff/count: -4606 | change: -31.5%
count: 2410 | rss: 24023040 | diff: -11075584 | diff/count: -4596 | change: -31.56%
count: 2420 | rss: 17842176 | diff: -17256448 | diff/count: -7131 | change: -49.17%
count: 2430 | rss: 17842176 | diff: -17256448 | diff/count: -7101 | change: -49.17%
count: 2440 | rss: 17842176 | diff: -17256448 | diff/count: -7072 | change: -49.17%
count: 2450 | rss: 17842176 | diff: -17256448 | diff/count: -7043 | change: -49.17%
count: 2460 | rss: 17842176 | diff: -17256448 | diff/count: -7015 | change: -49.17%
count: 2470 | rss: 17842176 | diff: -17256448 | diff/count: -6986 | change: -49.17%
count: 2480 | rss: 17842176 | diff: -17256448 | diff/count: -6958 | change: -49.17%
count: 2490 | rss: 17842176 | diff: -17256448 | diff/count: -6930 | change: -49.17%
count: 2500 | rss: 17842176 | diff: -17256448 | diff/count: -6903 | change: -49.17%
count: 2510 | rss: 17842176 | diff: -17256448 | diff/count: -6875 | change: -49.17%
count: 2520 | rss: 17842176 | diff: -17256448 | diff/count: -6848 | change: -49.17%
count: 2530 | rss: 17842176 | diff: -17256448 | diff/count: -6821 | change: -49.17%
count: 2540 | rss: 17842176 | diff: -17256448 | diff/count: -6794 | change: -49.17%
count: 2550 | rss: 17842176 | diff: -17256448 | diff/count: -6767 | change: -49.17%
count: 2560 | rss: 17842176 | diff: -17256448 | diff/count: -6741 | change: -49.17%
count: 2570 | rss: 17842176 | diff: -17256448 | diff/count: -6715 | change: -49.17%
count: 2580 | rss: 17842176 | diff: -17256448 | diff/count: -6689 | change: -49.17%
count: 2590 | rss: 17842176 | diff: -17256448 | diff/count: -6663 | change: -49.17%
count: 2600 | rss: 17842176 | diff: -17256448 | diff/count: -6637 | change: -49.17%
count: 2610 | rss: 17862656 | diff: -17235968 | diff/count: -6604 | change: -49.11%
count: 2620 | rss: 17862656 | diff: -17235968 | diff/count: -6579 | change: -49.11%
count: 2630 | rss: 17862656 | diff: -17235968 | diff/count: -6554 | change: -49.11%
count: 2640 | rss: 17862656 | diff: -17235968 | diff/count: -6529 | change: -49.11%
count: 2650 | rss: 17862656 | diff: -17235968 | diff/count: -6504 | change: -49.11%
count: 2660 | rss: 17862656 | diff: -17235968 | diff/count: -6480 | change: -49.11%
count: 2670 | rss: 17862656 | diff: -17235968 | diff/count: -6455 | change: -49.11%
count: 2680 | rss: 17862656 | diff: -17235968 | diff/count: -6431 | change: -49.11%
count: 2690 | rss: 17862656 | diff: -17235968 | diff/count: -6407 | change: -49.11%
count: 2700 | rss: 17842176 | diff: -17256448 | diff/count: -6391 | change: -49.17%
count: 2710 | rss: 17842176 | diff: -17256448 | diff/count: -6368 | change: -49.17%
count: 2720 | rss: 17842176 | diff: -17256448 | diff/count: -6344 | change: -49.17%
count: 2730 | rss: 17842176 | diff: -17256448 | diff/count: -6321 | change: -49.17%
count: 2740 | rss: 17842176 | diff: -17256448 | diff/count: -6298 | change: -49.17%
count: 2750 | rss: 17842176 | diff: -17256448 | diff/count: -6275 | change: -49.17%
count: 2760 | rss: 17735680 | diff: -17362944 | diff/count: -6291 | change: -49.47%

Based on your assumption, I guess it also makes sense that you've seen only a minor increase, since your connection parameter is only dest="QM7" while I am providing a bunch of parameters, thus allocationg more memory.

By the way, dest seems to be an undocumented Connection parameter: http://sap.github.io/PyRFC/pyrfc.html#pyrfc.Connection

But after some searching I found examples in the Destination Sections section of sapnwrfc.ini

Side note: config['dtime'] isn't documented, either.

I will create another post with the Red Hat logs once they are in.

Thanks again for taking the time to look into this.

mpf82 commented 1 year ago

Here's another log with the loop modified as follows:

cnxn = connect()
while 1:
    count += 1
    assert cnxn.alive is True
    cnxn.reopen()
    if not (count % 10):
        time.sleep(3)
        mem_diff()

Again, the max increase seems to be around 167936 to 188416 and at some point (agressive) garbage collecion sets in.

I would say, that supports the assumptions, that there's a leak in Connection.__init__ - with self._connection = ConnectionParameters(**params) being the only call with explicit memory allocation.

3.9.13 (tags/v3.9.13:6de2ca5, May 17 2022, 16:36:42) [MSC v.1929 64 bit (AMD64)]
2.7.0 {'major': 7500, 'minor': 0, 'patchLevel': 11, 'platform': 'win32'}
rss_init: 34639872
count: 10 | rss: 34639872 | diff: 0 | diff/count: 0 | change: 0.0%
count: 20 | rss: 34672640 | diff: 32768 | diff/count: 1638 | change: 0.09%
count: 30 | rss: 34693120 | diff: 53248 | diff/count: 1775 | change: 0.15%
count: 40 | rss: 34713600 | diff: 73728 | diff/count: 1843 | change: 0.21%
count: 50 | rss: 34734080 | diff: 94208 | diff/count: 1884 | change: 0.27%
count: 60 | rss: 34754560 | diff: 114688 | diff/count: 1911 | change: 0.33%
count: 70 | rss: 34758656 | diff: 118784 | diff/count: 1697 | change: 0.34%
count: 80 | rss: 34758656 | diff: 118784 | diff/count: 1485 | change: 0.34%
count: 90 | rss: 34758656 | diff: 118784 | diff/count: 1320 | change: 0.34%
count: 100 | rss: 34758656 | diff: 118784 | diff/count: 1188 | change: 0.34%
count: 110 | rss: 34758656 | diff: 118784 | diff/count: 1080 | change: 0.34%
count: 120 | rss: 34758656 | diff: 118784 | diff/count: 990 | change: 0.34%
count: 130 | rss: 34758656 | diff: 118784 | diff/count: 914 | change: 0.34%
count: 140 | rss: 34734080 | diff: 94208 | diff/count: 673 | change: 0.27%
count: 150 | rss: 34734080 | diff: 94208 | diff/count: 628 | change: 0.27%
count: 160 | rss: 34734080 | diff: 94208 | diff/count: 589 | change: 0.27%
count: 170 | rss: 34734080 | diff: 94208 | diff/count: 554 | change: 0.27%
count: 180 | rss: 34734080 | diff: 94208 | diff/count: 523 | change: 0.27%
count: 190 | rss: 34734080 | diff: 94208 | diff/count: 496 | change: 0.27%
count: 200 | rss: 34734080 | diff: 94208 | diff/count: 471 | change: 0.27%
count: 210 | rss: 34734080 | diff: 94208 | diff/count: 449 | change: 0.27%
count: 220 | rss: 34734080 | diff: 94208 | diff/count: 428 | change: 0.27%
count: 230 | rss: 34734080 | diff: 94208 | diff/count: 410 | change: 0.27%
count: 240 | rss: 34734080 | diff: 94208 | diff/count: 393 | change: 0.27%
count: 250 | rss: 34734080 | diff: 94208 | diff/count: 377 | change: 0.27%
count: 260 | rss: 34734080 | diff: 94208 | diff/count: 362 | change: 0.27%
count: 270 | rss: 34734080 | diff: 94208 | diff/count: 349 | change: 0.27%
count: 280 | rss: 34734080 | diff: 94208 | diff/count: 336 | change: 0.27%
count: 290 | rss: 34734080 | diff: 94208 | diff/count: 325 | change: 0.27%
count: 300 | rss: 34734080 | diff: 94208 | diff/count: 314 | change: 0.27%
count: 310 | rss: 34734080 | diff: 94208 | diff/count: 304 | change: 0.27%
count: 320 | rss: 34734080 | diff: 94208 | diff/count: 294 | change: 0.27%
count: 330 | rss: 34803712 | diff: 163840 | diff/count: 496 | change: 0.47%
count: 340 | rss: 34803712 | diff: 163840 | diff/count: 482 | change: 0.47%
count: 350 | rss: 34803712 | diff: 163840 | diff/count: 468 | change: 0.47%
count: 360 | rss: 34803712 | diff: 163840 | diff/count: 455 | change: 0.47%
count: 370 | rss: 34803712 | diff: 163840 | diff/count: 443 | change: 0.47%
count: 380 | rss: 34803712 | diff: 163840 | diff/count: 431 | change: 0.47%
count: 390 | rss: 34803712 | diff: 163840 | diff/count: 420 | change: 0.47%
count: 400 | rss: 34803712 | diff: 163840 | diff/count: 410 | change: 0.47%
count: 410 | rss: 34803712 | diff: 163840 | diff/count: 400 | change: 0.47%
count: 420 | rss: 34803712 | diff: 163840 | diff/count: 390 | change: 0.47%
count: 430 | rss: 34803712 | diff: 163840 | diff/count: 381 | change: 0.47%
count: 440 | rss: 34803712 | diff: 163840 | diff/count: 372 | change: 0.47%
count: 450 | rss: 34779136 | diff: 139264 | diff/count: 309 | change: 0.4%
count: 460 | rss: 34779136 | diff: 139264 | diff/count: 303 | change: 0.4%
count: 470 | rss: 34779136 | diff: 139264 | diff/count: 296 | change: 0.4%
count: 480 | rss: 34779136 | diff: 139264 | diff/count: 290 | change: 0.4%
count: 490 | rss: 34779136 | diff: 139264 | diff/count: 284 | change: 0.4%
count: 500 | rss: 34779136 | diff: 139264 | diff/count: 279 | change: 0.4%
count: 510 | rss: 34779136 | diff: 139264 | diff/count: 273 | change: 0.4%
count: 520 | rss: 34779136 | diff: 139264 | diff/count: 268 | change: 0.4%
count: 530 | rss: 34779136 | diff: 139264 | diff/count: 263 | change: 0.4%
count: 540 | rss: 34779136 | diff: 139264 | diff/count: 258 | change: 0.4%
count: 550 | rss: 34779136 | diff: 139264 | diff/count: 253 | change: 0.4%
count: 560 | rss: 34779136 | diff: 139264 | diff/count: 249 | change: 0.4%
count: 570 | rss: 34779136 | diff: 139264 | diff/count: 244 | change: 0.4%
count: 580 | rss: 34779136 | diff: 139264 | diff/count: 240 | change: 0.4%
count: 590 | rss: 34779136 | diff: 139264 | diff/count: 236 | change: 0.4%
count: 600 | rss: 34779136 | diff: 139264 | diff/count: 232 | change: 0.4%
count: 610 | rss: 34779136 | diff: 139264 | diff/count: 228 | change: 0.4%
count: 620 | rss: 34779136 | diff: 139264 | diff/count: 225 | change: 0.4%
count: 630 | rss: 34779136 | diff: 139264 | diff/count: 221 | change: 0.4%
count: 640 | rss: 34779136 | diff: 139264 | diff/count: 218 | change: 0.4%
count: 650 | rss: 34779136 | diff: 139264 | diff/count: 214 | change: 0.4%
count: 660 | rss: 34779136 | diff: 139264 | diff/count: 211 | change: 0.4%
count: 670 | rss: 34779136 | diff: 139264 | diff/count: 208 | change: 0.4%
count: 680 | rss: 34828288 | diff: 188416 | diff/count: 277 | change: 0.54%
count: 690 | rss: 34828288 | diff: 188416 | diff/count: 273 | change: 0.54%
count: 700 | rss: 34828288 | diff: 188416 | diff/count: 269 | change: 0.54%
count: 710 | rss: 34828288 | diff: 188416 | diff/count: 265 | change: 0.54%
count: 720 | rss: 34828288 | diff: 188416 | diff/count: 262 | change: 0.54%
count: 730 | rss: 34828288 | diff: 188416 | diff/count: 258 | change: 0.54%
count: 740 | rss: 34828288 | diff: 188416 | diff/count: 255 | change: 0.54%
count: 750 | rss: 34828288 | diff: 188416 | diff/count: 251 | change: 0.54%
count: 760 | rss: 34787328 | diff: 147456 | diff/count: 194 | change: 0.43%
count: 770 | rss: 34787328 | diff: 147456 | diff/count: 192 | change: 0.43%
count: 780 | rss: 34787328 | diff: 147456 | diff/count: 189 | change: 0.43%
count: 790 | rss: 34787328 | diff: 147456 | diff/count: 187 | change: 0.43%
count: 800 | rss: 34787328 | diff: 147456 | diff/count: 184 | change: 0.43%
count: 810 | rss: 34787328 | diff: 147456 | diff/count: 182 | change: 0.43%
count: 820 | rss: 34787328 | diff: 147456 | diff/count: 180 | change: 0.43%
count: 830 | rss: 34787328 | diff: 147456 | diff/count: 178 | change: 0.43%
count: 840 | rss: 34787328 | diff: 147456 | diff/count: 176 | change: 0.43%
count: 850 | rss: 34787328 | diff: 147456 | diff/count: 173 | change: 0.43%
count: 860 | rss: 34787328 | diff: 147456 | diff/count: 171 | change: 0.43%
count: 870 | rss: 34787328 | diff: 147456 | diff/count: 169 | change: 0.43%
count: 880 | rss: 34787328 | diff: 147456 | diff/count: 168 | change: 0.43%
count: 890 | rss: 34787328 | diff: 147456 | diff/count: 166 | change: 0.43%
count: 900 | rss: 34787328 | diff: 147456 | diff/count: 164 | change: 0.43%
count: 910 | rss: 34787328 | diff: 147456 | diff/count: 162 | change: 0.43%
count: 920 | rss: 34787328 | diff: 147456 | diff/count: 160 | change: 0.43%
count: 930 | rss: 34787328 | diff: 147456 | diff/count: 159 | change: 0.43%
count: 940 | rss: 34787328 | diff: 147456 | diff/count: 157 | change: 0.43%
count: 950 | rss: 34787328 | diff: 147456 | diff/count: 155 | change: 0.43%
count: 960 | rss: 34787328 | diff: 147456 | diff/count: 154 | change: 0.43%
count: 970 | rss: 34787328 | diff: 147456 | diff/count: 152 | change: 0.43%
count: 980 | rss: 34787328 | diff: 147456 | diff/count: 150 | change: 0.43%
count: 990 | rss: 34787328 | diff: 147456 | diff/count: 149 | change: 0.43%
count: 1000 | rss: 34811904 | diff: 172032 | diff/count: 172 | change: 0.5%
count: 1010 | rss: 34811904 | diff: 172032 | diff/count: 170 | change: 0.5%
count: 1020 | rss: 34811904 | diff: 172032 | diff/count: 169 | change: 0.5%
count: 1030 | rss: 34811904 | diff: 172032 | diff/count: 167 | change: 0.5%
count: 1040 | rss: 34811904 | diff: 172032 | diff/count: 165 | change: 0.5%
count: 1050 | rss: 34811904 | diff: 172032 | diff/count: 164 | change: 0.5%
count: 1060 | rss: 34811904 | diff: 172032 | diff/count: 162 | change: 0.5%
count: 1070 | rss: 34811904 | diff: 172032 | diff/count: 161 | change: 0.5%
count: 1080 | rss: 34811904 | diff: 172032 | diff/count: 159 | change: 0.5%
count: 1090 | rss: 34811904 | diff: 172032 | diff/count: 158 | change: 0.5%
count: 1100 | rss: 34811904 | diff: 172032 | diff/count: 156 | change: 0.5%
count: 1110 | rss: 34787328 | diff: 147456 | diff/count: 133 | change: 0.43%
count: 1120 | rss: 34787328 | diff: 147456 | diff/count: 132 | change: 0.43%
count: 1130 | rss: 34787328 | diff: 147456 | diff/count: 130 | change: 0.43%
count: 1140 | rss: 34787328 | diff: 147456 | diff/count: 129 | change: 0.43%
count: 1150 | rss: 34787328 | diff: 147456 | diff/count: 128 | change: 0.43%
count: 1160 | rss: 34787328 | diff: 147456 | diff/count: 127 | change: 0.43%
count: 1170 | rss: 34787328 | diff: 147456 | diff/count: 126 | change: 0.43%
count: 1180 | rss: 34787328 | diff: 147456 | diff/count: 125 | change: 0.43%
count: 1190 | rss: 34787328 | diff: 147456 | diff/count: 124 | change: 0.43%
count: 1200 | rss: 34787328 | diff: 147456 | diff/count: 123 | change: 0.43%
count: 1210 | rss: 34787328 | diff: 147456 | diff/count: 122 | change: 0.43%
count: 1220 | rss: 34787328 | diff: 147456 | diff/count: 121 | change: 0.43%
count: 1230 | rss: 34787328 | diff: 147456 | diff/count: 120 | change: 0.43%
count: 1240 | rss: 34787328 | diff: 147456 | diff/count: 119 | change: 0.43%
count: 1250 | rss: 34787328 | diff: 147456 | diff/count: 118 | change: 0.43%
count: 1260 | rss: 34787328 | diff: 147456 | diff/count: 117 | change: 0.43%
count: 1270 | rss: 34787328 | diff: 147456 | diff/count: 116 | change: 0.43%
count: 1280 | rss: 34787328 | diff: 147456 | diff/count: 115 | change: 0.43%
count: 1290 | rss: 34787328 | diff: 147456 | diff/count: 114 | change: 0.43%
count: 1300 | rss: 34787328 | diff: 147456 | diff/count: 113 | change: 0.43%
count: 1310 | rss: 34787328 | diff: 147456 | diff/count: 113 | change: 0.43%
count: 1320 | rss: 34787328 | diff: 147456 | diff/count: 112 | change: 0.43%
count: 1330 | rss: 34807808 | diff: 167936 | diff/count: 126 | change: 0.48%
count: 1340 | rss: 34807808 | diff: 167936 | diff/count: 125 | change: 0.48%
count: 1350 | rss: 34807808 | diff: 167936 | diff/count: 124 | change: 0.48%
count: 1360 | rss: 34807808 | diff: 167936 | diff/count: 123 | change: 0.48%
count: 1370 | rss: 34807808 | diff: 167936 | diff/count: 123 | change: 0.48%
count: 1380 | rss: 34807808 | diff: 167936 | diff/count: 122 | change: 0.48%
count: 1390 | rss: 34807808 | diff: 167936 | diff/count: 121 | change: 0.48%
count: 1400 | rss: 34807808 | diff: 167936 | diff/count: 120 | change: 0.48%
count: 1410 | rss: 34787328 | diff: 147456 | diff/count: 105 | change: 0.43%
count: 1420 | rss: 34787328 | diff: 147456 | diff/count: 104 | change: 0.43%
count: 1430 | rss: 34787328 | diff: 147456 | diff/count: 103 | change: 0.43%
count: 1440 | rss: 34787328 | diff: 147456 | diff/count: 102 | change: 0.43%
count: 1450 | rss: 34787328 | diff: 147456 | diff/count: 102 | change: 0.43%
count: 1460 | rss: 34787328 | diff: 147456 | diff/count: 101 | change: 0.43%
count: 1470 | rss: 34787328 | diff: 147456 | diff/count: 100 | change: 0.43%
count: 1480 | rss: 34787328 | diff: 147456 | diff/count: 100 | change: 0.43%
count: 1490 | rss: 34787328 | diff: 147456 | diff/count: 99 | change: 0.43%
count: 1500 | rss: 34787328 | diff: 147456 | diff/count: 98 | change: 0.43%
count: 1510 | rss: 34787328 | diff: 147456 | diff/count: 98 | change: 0.43%
count: 1520 | rss: 34787328 | diff: 147456 | diff/count: 97 | change: 0.43%
count: 1530 | rss: 34787328 | diff: 147456 | diff/count: 96 | change: 0.43%
count: 1540 | rss: 34787328 | diff: 147456 | diff/count: 96 | change: 0.43%
count: 1550 | rss: 34787328 | diff: 147456 | diff/count: 95 | change: 0.43%
count: 1560 | rss: 34787328 | diff: 147456 | diff/count: 95 | change: 0.43%
count: 1570 | rss: 34787328 | diff: 147456 | diff/count: 94 | change: 0.43%
count: 1580 | rss: 34787328 | diff: 147456 | diff/count: 93 | change: 0.43%
count: 1590 | rss: 34787328 | diff: 147456 | diff/count: 93 | change: 0.43%
count: 1600 | rss: 34787328 | diff: 147456 | diff/count: 92 | change: 0.43%
count: 1610 | rss: 34787328 | diff: 147456 | diff/count: 92 | change: 0.43%
count: 1620 | rss: 34787328 | diff: 147456 | diff/count: 91 | change: 0.43%
count: 1630 | rss: 34787328 | diff: 147456 | diff/count: 90 | change: 0.43%
count: 1640 | rss: 34787328 | diff: 147456 | diff/count: 90 | change: 0.43%
count: 1650 | rss: 34787328 | diff: 147456 | diff/count: 89 | change: 0.43%
count: 1660 | rss: 34787328 | diff: 147456 | diff/count: 89 | change: 0.43%
count: 1670 | rss: 34807808 | diff: 167936 | diff/count: 101 | change: 0.48%
count: 1680 | rss: 34807808 | diff: 167936 | diff/count: 100 | change: 0.48%
count: 1690 | rss: 34807808 | diff: 167936 | diff/count: 99 | change: 0.48%
count: 1700 | rss: 34807808 | diff: 167936 | diff/count: 99 | change: 0.48%
count: 1710 | rss: 34807808 | diff: 167936 | diff/count: 98 | change: 0.48%
count: 1720 | rss: 34807808 | diff: 167936 | diff/count: 98 | change: 0.48%
count: 1730 | rss: 34807808 | diff: 167936 | diff/count: 97 | change: 0.48%
count: 1740 | rss: 34807808 | diff: 167936 | diff/count: 97 | change: 0.48%
count: 1750 | rss: 34807808 | diff: 167936 | diff/count: 96 | change: 0.48%
count: 1760 | rss: 34807808 | diff: 167936 | diff/count: 95 | change: 0.48%
count: 1770 | rss: 34807808 | diff: 167936 | diff/count: 95 | change: 0.48%
count: 1780 | rss: 34807808 | diff: 167936 | diff/count: 94 | change: 0.48%
count: 1790 | rss: 34787328 | diff: 147456 | diff/count: 82 | change: 0.43%
count: 1800 | rss: 34787328 | diff: 147456 | diff/count: 82 | change: 0.43%
count: 1810 | rss: 34787328 | diff: 147456 | diff/count: 81 | change: 0.43%
count: 1820 | rss: 34787328 | diff: 147456 | diff/count: 81 | change: 0.43%
count: 1830 | rss: 34787328 | diff: 147456 | diff/count: 81 | change: 0.43%
count: 1840 | rss: 34787328 | diff: 147456 | diff/count: 80 | change: 0.43%
count: 1850 | rss: 34787328 | diff: 147456 | diff/count: 80 | change: 0.43%
count: 1860 | rss: 34787328 | diff: 147456 | diff/count: 79 | change: 0.43%
count: 1870 | rss: 34787328 | diff: 147456 | diff/count: 79 | change: 0.43%
count: 1880 | rss: 34787328 | diff: 147456 | diff/count: 78 | change: 0.43%
count: 1890 | rss: 34787328 | diff: 147456 | diff/count: 78 | change: 0.43%
count: 1900 | rss: 34787328 | diff: 147456 | diff/count: 78 | change: 0.43%
count: 1910 | rss: 34787328 | diff: 147456 | diff/count: 77 | change: 0.43%
count: 1920 | rss: 34787328 | diff: 147456 | diff/count: 77 | change: 0.43%
count: 1930 | rss: 34787328 | diff: 147456 | diff/count: 76 | change: 0.43%
count: 1940 | rss: 34787328 | diff: 147456 | diff/count: 76 | change: 0.43%
count: 1950 | rss: 34787328 | diff: 147456 | diff/count: 76 | change: 0.43%
count: 1960 | rss: 34787328 | diff: 147456 | diff/count: 75 | change: 0.43%
count: 1970 | rss: 34787328 | diff: 147456 | diff/count: 75 | change: 0.43%
count: 1980 | rss: 34787328 | diff: 147456 | diff/count: 74 | change: 0.43%
count: 1990 | rss: 34787328 | diff: 147456 | diff/count: 74 | change: 0.43%
count: 2000 | rss: 34787328 | diff: 147456 | diff/count: 74 | change: 0.43%
count: 2010 | rss: 34807808 | diff: 167936 | diff/count: 84 | change: 0.48%
count: 2020 | rss: 33456128 | diff: -1183744 | diff/count: -586 | change: -3.42%
count: 2030 | rss: 33456128 | diff: -1183744 | diff/count: -583 | change: -3.42%
count: 2040 | rss: 33513472 | diff: -1126400 | diff/count: -552 | change: -3.25%
count: 2050 | rss: 33529856 | diff: -1110016 | diff/count: -541 | change: -3.2%
count: 2060 | rss: 33533952 | diff: -1105920 | diff/count: -537 | change: -3.19%
count: 2070 | rss: 33538048 | diff: -1101824 | diff/count: -532 | change: -3.18%
count: 2080 | rss: 33542144 | diff: -1097728 | diff/count: -528 | change: -3.17%
count: 2090 | rss: 33542144 | diff: -1097728 | diff/count: -525 | change: -3.17%
count: 2100 | rss: 33521664 | diff: -1118208 | diff/count: -532 | change: -3.23%
count: 2110 | rss: 33525760 | diff: -1114112 | diff/count: -528 | change: -3.22%
count: 2120 | rss: 33525760 | diff: -1114112 | diff/count: -526 | change: -3.22%
count: 2130 | rss: 33525760 | diff: -1114112 | diff/count: -523 | change: -3.22%
count: 2140 | rss: 33525760 | diff: -1114112 | diff/count: -521 | change: -3.22%
count: 2150 | rss: 33525760 | diff: -1114112 | diff/count: -518 | change: -3.22%
count: 2160 | rss: 33525760 | diff: -1114112 | diff/count: -516 | change: -3.22%
count: 2170 | rss: 33525760 | diff: -1114112 | diff/count: -513 | change: -3.22%
count: 2180 | rss: 33525760 | diff: -1114112 | diff/count: -511 | change: -3.22%
count: 2190 | rss: 33525760 | diff: -1114112 | diff/count: -509 | change: -3.22%
count: 2200 | rss: 33525760 | diff: -1114112 | diff/count: -506 | change: -3.22%
count: 2210 | rss: 33525760 | diff: -1114112 | diff/count: -504 | change: -3.22%
count: 2220 | rss: 33525760 | diff: -1114112 | diff/count: -502 | change: -3.22%
count: 2230 | rss: 33525760 | diff: -1114112 | diff/count: -500 | change: -3.22%
count: 2240 | rss: 33525760 | diff: -1114112 | diff/count: -497 | change: -3.22%
count: 2250 | rss: 33525760 | diff: -1114112 | diff/count: -495 | change: -3.22%
count: 2260 | rss: 33525760 | diff: -1114112 | diff/count: -493 | change: -3.22%
count: 2270 | rss: 33525760 | diff: -1114112 | diff/count: -491 | change: -3.22%
count: 2280 | rss: 33525760 | diff: -1114112 | diff/count: -489 | change: -3.22%
count: 2290 | rss: 33525760 | diff: -1114112 | diff/count: -487 | change: -3.22%
count: 2300 | rss: 33525760 | diff: -1114112 | diff/count: -484 | change: -3.22%
count: 2310 | rss: 33525760 | diff: -1114112 | diff/count: -482 | change: -3.22%
count: 2320 | rss: 33525760 | diff: -1114112 | diff/count: -480 | change: -3.22%
count: 2330 | rss: 33525760 | diff: -1114112 | diff/count: -478 | change: -3.22%
count: 2340 | rss: 33525760 | diff: -1114112 | diff/count: -476 | change: -3.22%
count: 2350 | rss: 33525760 | diff: -1114112 | diff/count: -474 | change: -3.22%
count: 2360 | rss: 17723392 | diff: -16916480 | diff/count: -7168 | change: -48.84%
count: 2370 | rss: 17731584 | diff: -16908288 | diff/count: -7134 | change: -48.81%
mpf82 commented 1 year ago

Red Hat logs are in - seems to be no memory increase at all now:

3.11.1 (main, Feb  1 2023, 10:52:25) [GCC 8.5.0 20210514 (Red Hat 8.5.0-4)]
2.7.0 {'major': 7500, 'minor': 0, 'patchLevel': 11, 'platform': 'linux'}
rss_init: 33841152
count: 10 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 20 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 30 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 40 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 50 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 60 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 70 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 80 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 90 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 100 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 110 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 120 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 130 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 140 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 150 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 160 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 170 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 180 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 190 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 200 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 210 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 220 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 230 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 240 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 250 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 260 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 270 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 280 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 290 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 300 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 310 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 320 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 330 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 340 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 350 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 360 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 370 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 380 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 390 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 400 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 410 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 420 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 430 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 440 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 450 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 460 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 470 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 480 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 490 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 500 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 510 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 520 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 530 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 540 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 550 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 560 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 570 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 580 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 590 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 600 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 610 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 620 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 630 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 640 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 650 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 660 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 670 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 680 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 690 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 700 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 710 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 720 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 730 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 740 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 750 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 760 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 770 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 780 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 790 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 800 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 810 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 820 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 830 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 840 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 850 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 860 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 870 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 880 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 890 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 900 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 910 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 920 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 930 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 940 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 950 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 960 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 970 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 980 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 990 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 1000 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 1010 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 1020 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 1030 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 1040 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 1050 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 1060 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 1070 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 1080 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 1090 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 1100 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 1110 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 1120 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 1130 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 1140 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 1150 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 1160 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 1170 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 1180 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 1190 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 1200 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 1210 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 1220 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 1230 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 1240 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 1250 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 1260 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 1270 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 1280 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 1290 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 1300 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 1310 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 1320 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 1330 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 1340 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 1350 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 1360 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 1370 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 1380 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 1390 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 1400 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 1410 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 1420 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 1430 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 1440 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 1450 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
count: 1460 | rss: 33841152 | diff: 0 | diff/count: 0 | change: 0.0%
bsrdjan commented 1 year ago

By the way, dest seems to be an undocumented Connection parameter: http://sap.github.io/PyRFC/pyrfc.html#pyrfc.Connection

Connection parameters for ABAP systems are documented in SAP NW RFC SDK file sapnwrfc.ini. All parameters, including "dest" are documented there.

Side note: config['dtime'] isn't documented, either.

dtime is PyRFC connection option, documented here: http://sap.github.io/PyRFC/client.html#configuration-of-a-connection

I would say, that supports the assumptions, that there's a leak in Connection.init

The memory must be allocated for connection parameters conversion to SAP unicode and that memory is released when connection instance disposed. It could be released after opening connection but then reopen() would not work because connection parameters destroyed.

That is why free() method is provided, to programatically release connection parameters' memory, when needed. It makes sense to use it in your scenario and it will stop the used memory increase. Once the free() is called, the connection is also closed and can't be re-opened because connection parameters are not available any more.

mpf82 commented 1 year ago

Ah, okay, would be nice though if the API at http://sap.github.io/PyRFC/pyrfc.html#pyrfc.Connection would mention that there are more connection options than the ones explicitely mentioned and point to sapnwrfc.ini.

As for dtime, the API at http://sap.github.io/PyRFC/pyrfc.html#pyrfc.Connection does not mention it, but you are right, it's documented, just not where I expected it.

For our use case it's indeed sufficient to call close() and then free() (or just free() for that matter), since this Connection instance will never be used again in the app.

About reopen: I was only pointing that there's no leak, just a slight increase that levels out after some time, which makes sense, since ConnectionParameters is only created once. We're already using reopen in case of a connection problem, especially in scenarios where we are using only a single Connection instance for all RFC calls, and not a new instance for each call.

I have no idea, why Python garbage collector never called __del__() on the closed Connection, but I just noticed the comment on free()

Explicitly free connection parameters and close the connection. Note that this is usually required because the object destruction can be delayed by the garbage collection and problems may occur when too many connections are opened.

Though free() never is mentioned in the API/docs http://sap.github.io/PyRFC/search.html?q=free

Closing issue as resolved.

Thanks again.