Mercurial > hg
changeset 49424:360c156e1f81
obsstore: break the repo → obstore → repo loop
This should help the garbage collector to do its job. On repository with many
markers, the memory pressure from the obsstore can get quite serious.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 17 Aug 2022 02:43:44 +0200 |
parents | a974c52fb79a |
children | 35c9f0bc2648 |
files | mercurial/obsolete.py |
diffstat | 1 files changed, 10 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/obsolete.py Tue Aug 16 11:19:54 2022 -0400 +++ b/mercurial/obsolete.py Wed Aug 17 02:43:44 2022 +0200 @@ -70,6 +70,7 @@ import binascii import struct +import weakref from .i18n import _ from .pycompat import getattr @@ -561,10 +562,18 @@ # caches for various obsolescence related cache self.caches = {} self.svfs = svfs - self.repo = repo + self._repo = weakref.ref(repo) self._defaultformat = defaultformat self._readonly = readonly + @property + def repo(self): + r = self._repo() + if r is None: + msg = "using the obsstore of a deallocated repo" + raise error.ProgrammingError(msg) + return r + def __iter__(self): return iter(self._all)