Export to GitHub

pyodbc - issue #306

Memory leak when committing after a select on MySQL ODBC 5.2


Posted on Jan 22, 2013 by Swift Kangaroo

What steps will reproduce the problem?

See http://stackoverflow.com/questions/14126452/pyodbc-memory-leak-when-committing-after-select-statement

What is the expected output? What do you see instead?

No memory leak, instead that script will rapidly grow in memory usage until the OOM killer kills it off.

What version of the product are you using? On what operating system?

Only seems to happen with the MySQL ODBC connector 5.2 (the current version) on Windows and Linux.

Comment #1

Posted on Mar 28, 2013 by Grumpy Giraffe

(No comment was entered for this change.)

Comment #2

Posted on Jan 2, 2014 by Massive Wombat

Confirmed. Happens on Microsoft Server 2012 with SQL Server ODBC Driver 11. The memory usage grows without bounds. Tracked it down with the new tracemalloc module to the lines where cursor.execute() is called. It does not happen on linux, and it was not tested with a MySQL ODBC driver. Lastly, using the pypyodbc module does work as expected with no permanent memory growth.

Comment #3

Posted on Jan 2, 2014 by Massive Wombat

Sorry - didn't read the stackoverflow immediately. Just noticed this was the closest open issue to mine. (There was an open issue that was closer but it was closed back in 2011, so I figured this would be more appropriate.)

But removing cursor.commit() had no effect, and it does leak memory on inserts as well.

Status: Investigating

Labels:
Type-Defect Priority-Medium