@@ -266,6 +266,10 @@ def __init__(self, indexpath):
266266 super (PackIndexFile , self ).__init__ ()
267267 self ._indexpath = indexpath
268268
269+ def close (self ):
270+ mman .force_map_handle_removal_win (self ._indexpath )
271+ self ._cursor = None
272+
269273 def _set_cache_ (self , attr ):
270274 if attr == "_packfile_checksum" :
271275 self ._packfile_checksum = self ._cursor .map ()[- 40 :- 20 ]
@@ -527,6 +531,10 @@ class PackFile(LazyMixin):
527531 def __init__ (self , packpath ):
528532 self ._packpath = packpath
529533
534+ def close (self ):
535+ mman .force_map_handle_removal_win (self ._packpath )
536+ self ._cursor = None
537+
530538 def _set_cache_ (self , attr ):
531539 # we fill the whole cache, whichever attribute gets queried first
532540 self ._cursor = mman .make_cursor (self ._packpath ).use_region ()
@@ -668,6 +676,10 @@ def __init__(self, pack_or_index_path):
668676 self ._index = self .IndexFileCls ("%s.idx" % basename ) # PackIndexFile instance
669677 self ._pack = self .PackFileCls ("%s.pack" % basename ) # corresponding PackFile instance
670678
679+ def close (self ):
680+ self ._index .close ()
681+ self ._pack .close ()
682+
671683 def _set_cache_ (self , attr ):
672684 # currently this can only be _offset_map
673685 # TODO: make this a simple sorted offset array which can be bisected
0 commit comments