Patchwork [STABLE] verify: recover lost freeing of memory

login
register
mail settings
Submitter Martin von Zweigbergk
Date Feb. 1, 2016, 4:38 p.m.
Message ID <8447225bceda9005a38d.1454344728@waste.org>
Download mbox | patch
Permalink /patch/12935/
State Accepted
Headers show

Comments

Martin von Zweigbergk - Feb. 1, 2016, 4:38 p.m.
# HG changeset patch
# User Martin von Zweigbergk <martinvonz@google.com>
# Date 1454229115 28800
#      Sun Jan 31 00:31:55 2016 -0800
# Branch stable
# Node ID 8447225bceda9005a38d109d424d403dae10b8d8
# Parent  88609cfa37455815e4d6acd45e2a8893720c065b
verify: recover lost freeing of memory

In df8973e1fb45 (verify: move file cross checking to its own function,
2016-01-05), "mflinkrevs = None" was moved into function, so the
reference was cleared there, but the calling function now held on to
the variable. The point of clearing it was presumably to free up
memory, so let's move the clearing to the calling function where it
makes a difference. Also change "mflinkrevs = None" to "del
mflinkrevs", since the comment about scope now surely is obsolete.
Pierre-Yves David - Feb. 1, 2016, 5:50 p.m.
On 02/01/2016 04:38 PM, Martin von Zweigbergk wrote:
> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz@google.com>
> # Date 1454229115 28800
> #      Sun Jan 31 00:31:55 2016 -0800
> # Branch stable
> # Node ID 8447225bceda9005a38d109d424d403dae10b8d8
> # Parent  88609cfa37455815e4d6acd45e2a8893720c065b
> verify: recover lost freeing of memory

pushed to the clowncopter, thanks.

Patch

diff --git a/mercurial/verify.py b/mercurial/verify.py
--- a/mercurial/verify.py
+++ b/mercurial/verify.py
@@ -149,6 +149,7 @@ 
         filenodes = self._verifymanifest(mflinkrevs)
 
         self._crosscheckfiles(mflinkrevs, filelinkrevs, filenodes)
+        del mflinkrevs
 
         totalfiles, filerevisions = self._verifyfiles(filenodes, filelinkrevs)
 
@@ -249,7 +250,6 @@ 
                 ui.progress(_('crosschecking'), count, total=total)
                 self.err(c, _("changeset refers to unknown manifest %s") %
                          short(m))
-            mflinkrevs = None # del is bad here due to scope issues
 
             for f in sorted(filelinkrevs):
                 count += 1