In Python on Windows I can create a large file by
from mmap import mmap
f = open('big.file', 'w')
f.close()
f = open('big.file', 'r+')
m = mmap(f.fileno(), 10**9)
And now big.file
is (about) 1 gigabyte. On Linux, though, this will return ValueError: mmap length is greater than file size
.
Is there a way to get the same behavior on Linux as with Windows? That is, to be able to increase a file's size using mmap
?