Permalink
Browse files

Use ftruncate instead of write('\x00'*size)

  • Loading branch information...
schmichael committed Sep 21, 2011
1 parent 983cad5 commit bb604a6153b29eebb40ca240beb9d1a3947a6425
Showing with 1 addition and 1 deletion.
  1. +1 −1 mmstats.py
View
@@ -40,7 +40,7 @@ def _init_mmap(path=None, filename=None, size=PAGESIZE):
size = PAGESIZE
# Zero out the file
os.write(fd, '\x00' * size)
os.ftruncate(fd, size)
m = mmap.mmap(fd, size, mmap.MAP_SHARED, mmap.PROT_WRITE)
return (full_path, size, m)

0 comments on commit bb604a6

Please sign in to comment.