I am working with large matrixes, so I am using NumPy\'s memmap. However, I am getting an error as apparently the file descriptors used by memmap are not being closed.
Since the memmap does not take the open file descriptor, but the file name, I suppose you leak the temp_fd
file descriptor. Does os.close(temp_fd)
help?
Great that it works.
Since you can pass numpy.memmap a file-like object, you could create one from the file descriptor you already have, temp_fd
.
fobj = os.fdopen(temp_fd, "w+")
numpy.memmap(fobj, ...