This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author manuels
Recipients manuels
Date 2018-08-02.13:22:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1533216123.68.0.56676864532.issue34321@psf.upfronthosting.co.za>
In-reply-to
Content
mmap.mmap(fileno, length, flags, prot, access, offset) always clones the file descriptor that should be used [1].

The cloning of the file descriptor seems to be done to ensure that the file cannot be closed behind mmap's back, but if you are mmap()'ing a lot of memory regions of a file this can cause a 'Too many open files' error.

I would suggest to add an option to mmap.mmap() that tells it not to clone the file descriptor. This can cause an issue if the file is closed before accessing the mmapped region, so this fact should also be pointed out in the documentation.

[1] https://github.com/python/cpython/blob/master/Modules/mmapmodule.c#L1159
History
Date User Action Args
2018-08-02 13:22:03manuelssetrecipients: + manuels
2018-08-02 13:22:03manuelssetmessageid: <1533216123.68.0.56676864532.issue34321@psf.upfronthosting.co.za>
2018-08-02 13:22:03manuelslinkissue34321 messages
2018-08-02 13:22:03manuelscreate