# HG changeset patch # User FUJIWARA Katsunori # Date 1366282204 -32400 # Node ID 36067f5baf2475580a519468e347569181d945d9 # Parent c010cb6fdef787d3493725e1403d0a6f19b704d9 annotate: discard refcount of discarded annotation for memory efficiency Before this patch, refcount (managed in "needed") of the annotation result is kept as 1, even if corresponding annotation result is discarded from "hist", because it isn't decreased and discarded. In the history tree including merging revision, the most recent common ancestor of merged revisions is scanned twice. Refcount of such ancestor never becomes 0, because refcount is started from 1 at the second scanning. This prevents annotation results of merging revision in "hist" from being discarded, and decreases memory efficiency. This patch discards refcount of the annotation result, when the corresponding annotation is discarded from "hist". diff -r c010cb6fdef7 -r 36067f5baf24 mercurial/context.py --- a/mercurial/context.py Thu Apr 18 16:46:09 2013 +0400 +++ b/mercurial/context.py Thu Apr 18 19:50:04 2013 +0900 @@ -713,6 +713,7 @@ curr = pair(hist[p], curr) if needed[p] == 1: del hist[p] + del needed[p] else: needed[p] -= 1