[CONPY-126] Memory leak on connection object Created: 2020-10-31  Updated: 2021-02-09  Resolved: 2020-11-01

Status: Closed
Project: MariaDB Connector/Python
Component/s: Generic
Affects Version/s: 1.0.4
Fix Version/s: 1.0.5

Type: Bug Priority: Major
Reporter: Luciano Barcaro Assignee: Georg Richter
Resolution: Fixed Votes: 0
Labels: None


 Description   

Found a small memory leak on mariadb connection object.

import resource
import mariadb as driver
# import mysql.connector as driver
from time import sleep
 
connection_parameters = {
    'host': '10.0.0.2',
    'user': 'me',
    'password': '123123',
    'database': 'test'
}
 
while True:
    for i in range(200):
        db = driver.connect(**connection_parameters)
        db.close()
    usage = resource.getrusage(resource.RUSAGE_SELF)
    print(f'Mem: {usage[2]}')
    sleep(1)

Just in a few iterations the memory usage report grows if mariadb is used.



 Comments   
Comment by Georg Richter [ 2020-11-01 ]

Fixed - rev. 37864dd8311a9cbac5ae77bde653ec15162b7142

Comment by Gregory Gygax [ 2021-02-09 ]

1.0.5 does not fix the issue for me. Using the sample script, I can still observe memory usage growing. Using python3.9 on arch linux.

Comment by Georg Richter [ 2021-02-09 ]

Gregory, unfortunately we added another leak after closing this issue. See CONC-142

Generated at Thu Feb 08 03:30:27 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.