changeset 41286:00b314c42094

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.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 13 Jan 2019 14:56:26 +0900
parents cf8677cd7286
children c0221d929eb9
files mercurial/revlog.py
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revlog.py	Wed Sep 26 21:41:52 2018 +0900
+++ b/mercurial/revlog.py	Sun Jan 13 14:56:26 2019 +0900
@@ -440,6 +440,8 @@
             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()