# HG changeset patch # User Gregory Szorc # Date 2014-05-22 01:02:35 # Node ID 99ba1d082287e5d701c86dfea7e7a5f9adc9dad4 # Parent 3cb2da25b1713b0da0fde70f6af312d7b7cf987b localrepo: prevent leak of transaction object (issue4258) The onclose() closure added in cd443c7589cc held a regular reference to the transaction object. This was causing the transaction to not gc and a leak to occur. The closure now holds a reference to the weakref instance and the leak goes away. diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -858,7 +858,7 @@ class localrepository(object): _("abandoned transaction found - run hg recover")) def onclose(): - self.store.write(tr) + self.store.write(self._transref()) self._writejournal(desc) renames = [(vfs, x, undoname(x)) for vfs, x in self._journalfiles()]