gh-155003: Don't try to close mmap in SharedMemory.__del__ - #155070
Open
takluyver wants to merge 1 commit into
Open
gh-155003: Don't try to close mmap in SharedMemory.__del__#155070takluyver wants to merge 1 commit into
takluyver wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is an alternative to #155007, keeping the file descriptor in the object and fixing the
__del__method to close it without trying to close the mmap or memoryview, which was my original idea in #155003.I could add, in this PR or separately:
posix_fallocate()change as in gh-155003: Don't keep file descriptor in multiprocessing SharedMemory object #155007 - but with this option it's orthogonal..fileno()method, which is a convention for higher level objects which wrap an fd.mmap(..., trackfd=False)to skip the duplicate fd within mmap (at a cost of breaking potential workarounds usingsm._mmap.resize()&.size())