I can't find any documentation on how numpy handles unmapping of previously memory mapped regions: munmap for numpy.memmap() and numpy.load(mmap_mode).
My guess is it's done only at garbage collection time, is that correct?
Memory-mapped files are used for accessing small segments of large files on disk, without reading the entire file into memory. NumPy's memmap's are array-like objects. This differs from Python's mmap module, which uses file-like objects.
As far as I understand, there are currently two ways to close a memmap "file"; del fp or fp.
Yes, it's only closed when the object is garbage-collected; memmap.close method does nothing.
You can call x._mmap.close(), but keep in mind that any further access to the x object will crash python.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With