Skip to content

Commit

Permalink
Do munmap on SysDict#__load().
Browse files Browse the repository at this point in the history
  • Loading branch information
ueno committed Sep 6, 2010
1 parent 8341991 commit a244d24
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions engine/skk.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@ def __init__(self, path, encoding=DictBase.ENCODING):
self.__path = path
self.__mtime = 0
self.__encoding = encoding
self.__mmap = None
self.reload()

path = property(lambda self: self.__path)
Expand All @@ -484,6 +485,8 @@ def reload(self):

def __load(self):
with open(self.__path, 'r') as fp:
if self.__mmap:
self.__mmap.close()
self.__mmap = mmap.mmap(fp.fileno(), 0, prot=mmap.PROT_READ)
while True:
pos = self.__mmap.tell()
Expand Down

0 comments on commit a244d24

Please sign in to comment.