Skip to content

Memory leak in adodbapi (resources not released when cursor goes out of scope) #1170

Closed
@bkline

Description

I've been tearing my hair out trying to find out why some of our long-running jobs were exhausting all of the memory on the servers. I finally tracked it down to a failure of the adodbapi Cursor objects to release the memory of the resources under their control when they go out of scope. The following code snippet will eventually exhaust all memory on the machine when running under adodbapi:

while True:
    cursor = conn.cursor()

With other DB API 2.0 packages (for example, pyodbc), memory usage remains flat running this same code, as all of their resources are released when the cursor objects go out of scope.

A workaround is to explicitly close all cursor objects before they go out of scope everywhere in your code.

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions