-
Notifications
You must be signed in to change notification settings - Fork 564
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Memory leak after getting [42000][ODBC Driver 17 for SQL Server] (1105) (SQLParamData) Error #702
Comments
Well, I can see there would be an increase in memory, but I don't think it is where you are looking. When inserting a string parameter, If I'm right about this, the problem is that the parameter did not get garbage collected. I don't know what the code looked like that you originally noticed the issue in, but make sure two things are true:
In the test code I saw, the parameter would be out of scope, but the cursor was not closed, so it still had a reference to the parameter. I think the memory would be freed as soon as you (1) closed the cursor or (2) executed a different statement. Do you mind testing that? In fact, it wouldn't be hard to test using your existing test. Just remove the C++ changes and update your test to close the cursor and connection before measuring memory a second time. |
Initialiy the code I wanted to add was only
I will edit my test to close and Nullify the object, then froce the GC.
Happily, I have tested it and post a photo for the results. |
After some more debugging I have changed my fix. Please take another look. I have swapped the order of
in but I still think maybe |
Possibly related: #802 |
@jfuernsinn ; cc: @Mizaro @mkleehammer I just tested the #703 patch and unfortunately it does not appear to resolve the #802 issue:
|
And here's a slightly longer test, just to see if garbage collection might eventually kick in:
|
@gordthompson |
@Mizaro - Yes, indeed, that patch does seem to fix it:
|
Environment
Issue
Given the following code:
I got the following error:
The fact that the error is happending is fine. The problem is with the memory usage of the python.exe process. The expected behavior will be a small amount of new memory in use due to python's default behavior but the observed behavior is that there is about 20MB of additional memory usage. Even after calling GC or trying a lot of other methods, the memory still in use.
I have debugged this Issue and created a fork with a branch called
bugfix/SQLParamData_MemoryLeak
that fixes this problem.The text was updated successfully, but these errors were encountered: