-
Notifications
You must be signed in to change notification settings - Fork 54
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 on exception handling with yajl2_c backend #97
Comments
Thanks @mhugo for the concise and useful report. I just double-checked I can reproduce the issue on my side. I'll have a look now to see if I can quickly find out the culprit, otherwise it might take a bit longer. |
After reading data into a buffer the reading_generator_next function calls invokes the underlying yajl parsing routine, which might return successfully or not. There was a memory leak in the latter case, since the "view" Py_buffer object was not being released before checking for NULL returns and returning NULL ourselves. This commit fixes the bug by ensuring we release the "view" object before any returns, ensuring memory isn't leaked. This was originally reported in #97. Signed-off-by: Rodrigo Tobar <rtobar@icrar.org>
@mhugo: found it and potentially fixed it, please give it a try under the It indeed was very specific to the |
Hi @rtobar I confirm the problem is solved on the When do you think would be the next release that will include this fix ? |
After reading data into a buffer the reading_generator_next function calls invokes the underlying yajl parsing routine, which might return successfully or not. There was a memory leak in the latter case, since the "view" Py_buffer object was not being released before checking for NULL returns and returning NULL ourselves. This commit fixes the bug by ensuring we release the "view" object before any returns, ensuring memory isn't leaked. This was originally reported in #97. Signed-off-by: Rodrigo Tobar <rtobar@icrar.org>
@mhugo thanks for the confirmation 👍 I've put the fix now in |
3.2.1 has now been published |
Excellent ! Thank you very much again for your reactivity |
Describe the bug
I think I found a memory leak with the yajl2_c backend when
ijson.items
raises an exception, some memory does not seem to be correctly deallocated.How to reproduce*
Here is a small Python code to reproduce the issue:
Example output:
Expected behavior
The same run, but with less memory consumed :)
Execution information:
The text was updated successfully, but these errors were encountered: