Issue 306: Memory leak when committing after a select on MySQL ODBC 5.2
Status:  Investigating
Owner: ----
Reported by p...@pdouglas.net, Jan 22, 2013
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.


Mar 28, 2013
Project Member #1 mkleehammer
(No comment was entered for this change.)
Status: Investigating
Jan 2, 2014
#2 ykuz...@gmail.com
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.
Jan 2, 2014
#3 ykuz...@gmail.com
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.