Skip to content

Remove spurious INCREF. #1

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

antocuni
Copy link
Collaborator

@antocuni antocuni commented Aug 6, 2020

As it is written, this INCREF is spurious and causes a memory leak. See
e.g. the usage pattern in the official CPython's xxlimited.c example module:

https://github.com/python/cpython/blob/master/Modules/xxlimited.c#L262

As it is written, this INCREF is spurious and causes a memory leak. See
e.g. the usage pattern in the official CPython's xxlimited.c example module:

https://github.com/python/cpython/blob/master/Modules/xxlimited.c#L262
@antocuni
Copy link
Collaborator Author

antocuni commented Aug 6, 2020

After staring at the code more, we realized that the original idea was maybe that the INCREF was needed because ptr_ArrayType is a static global variable?
In that case this PR might be wrong, but adding a comment explaining it might help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant