# HG changeset patch # User Yuya Nishihara # Date 2019-01-13 05:56:26 # Node ID 00b314c420945aeb56745a58c83dc321fc6b747b # Parent cf8677cd7286b408f19ac2a13d5bf9c4d4562ba8 revlog: document that mmap resources are released implicitly by GC It's okay-ish, but currently the open fd and the mapping itself are leaked until the indexdata is deallocated. If revlog had close(), the underlying resources should be closed there as well, but AFAIK there's no such hook point. diff --git a/mercurial/revlog.py b/mercurial/revlog.py --- a/mercurial/revlog.py +++ b/mercurial/revlog.py @@ -440,6 +440,8 @@ class revlog(object): with self._indexfp() as f: if (mmapindexthreshold is not None and self.opener.fstat(f).st_size >= mmapindexthreshold): + # TODO: should .close() to release resources without + # relying on Python GC indexdata = util.buffer(util.mmapread(f)) else: indexdata = f.read()