Skip to content

Commit

Permalink
Use ftruncate instead of write('\x00'*size)
Browse files Browse the repository at this point in the history
  • Loading branch information
schmichael committed Sep 21, 2011
1 parent 983cad5 commit bb604a6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mmstats.py
Expand Up @@ -40,7 +40,7 @@ def _init_mmap(path=None, filename=None, size=PAGESIZE):
size = PAGESIZE size = PAGESIZE


# Zero out the file # Zero out the file
os.write(fd, '\x00' * size) os.ftruncate(fd, size)


m = mmap.mmap(fd, size, mmap.MAP_SHARED, mmap.PROT_WRITE) m = mmap.mmap(fd, size, mmap.MAP_SHARED, mmap.PROT_WRITE)
return (full_path, size, m) return (full_path, size, m)
Expand Down

0 comments on commit bb604a6

Please sign in to comment.