D4582: censor: use a reasonable amount of memory

valentin.gatienbaron (Valentin Gatien-Baron) phabricator at mercurial-scm.org
Thu Sep 13 20:31:19 UTC 2018


valentin.gatienbaron created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Before this change, trying to censor some random revision uses an ever
  increasing amount of memory (I stopped at 20GB, but it was by no means
  finished), presumably because these contexts have a lot of
  information that is kept alive.
  After this change, the memory usage plateaus quickly.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D4582

AFFECTED FILES
  hgext/censor.py

CHANGE DETAILS

diff --git a/hgext/censor.py b/hgext/censor.py
--- a/hgext/censor.py
+++ b/hgext/censor.py
@@ -83,7 +83,7 @@
         raise error.Abort(_('file does not exist at revision %s') % rev)
 
     fnode = fctx.filenode()
-    headctxs = [repo[c] for c in repo.heads()]
+    headctxs = (repo[c] for c in repo.heads())
     heads = [c for c in headctxs if path in c and c.filenode(path) == fnode]
     if heads:
         headlist = ', '.join([short(c.node()) for c in heads])



To: valentin.gatienbaron, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list