Skip to content

Conversation

juliantaylor
Copy link
Contributor

When a cython object contains numpy arrays the pure python allocation
hook can trigger during cythons dealloc method and trigger a second
deletion of the object currently being deleted.
To minimize the probabily that that happens disable the garbage
collector during the hook.
As this involves python calls it is still possible that a double delete
occurs but chances are lowered, a proper solution would be C only hook
like python 3.4 tracemalloc module.

Closes gh-4834

When a cython object contains numpy arrays the pure python allocation
hook can trigger during cythons __dealloc__ method and trigger a second
deletion of the object currently being deleted.
To minimize the probabily that that happens disable the garbage
collector during the hook.
As this involves python calls it is still possible that a double delete
occurs but chances are lowered, a proper solution would be C only hook
like python 3.4 tracemalloc module.

Closes numpygh-4834
@charris
Copy link
Member

charris commented Jul 5, 2014

LGTM, thanks Julian.

charris added a commit that referenced this pull request Jul 5, 2014
BUG: disable garbage collector during memory allocation hook
@charris charris merged commit 81242f6 into numpy:master Jul 5, 2014
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.

Segmentation fault when using memory allocation tracker
2 participants