diff -r c8bef5664305 Lib/multiprocessing/heap.py --- a/Lib/multiprocessing/heap.py Mon Mar 31 13:50:45 2014 -0400 +++ b/Lib/multiprocessing/heap.py Mon Mar 31 20:53:00 2014 +0100 @@ -69,7 +69,12 @@ os.unlink(name) util.Finalize(self, os.close, (self.fd,)) with open(self.fd, 'wb', closefd=False) as f: - f.write(b'\0'*size) + bs = 1024 * 1024 + if size>=bs: + zeros = b'\0'*bs + for _ in range(size//bs): + f.write(zeros) + f.write(b'\0'*(size%bs)) self.buffer = mmap.mmap(self.fd, self.size) def reduce_arena(a):