Mercurial > hg
view tests/test-revlog-mmapindex.t @ 39291:9f097214fbf3
index: embed nodetree in index object to avoid reference cycle
Since the index has a reference to a nodetree and the nodetree has a
reference back to the index, there is a reference cycle, so the index
(and its nodetree) can never be freed. This patch fixes that by making
"nodetree" a plan C struct that the index can embed, and also
introduces a new "nodetreeObject" that is a Python type wrapping the
nodetree struct.
Thanks to Yuya for noticing this and for suggesting the solution.
All tests passed on the first attempt once it compiled (I guess C is
like Haskell in this regard?).
Differential Revision: https://phab.mercurial-scm.org/D4372
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 24 Aug 2018 08:45:18 -0700 |
parents | 6ebe899b6551 |
children | 42d2b31cee0b |
line wrap: on
line source
create verbosemmap.py $ cat << EOF > verbosemmap.py > # extension to make util.mmapread verbose > > from __future__ import absolute_import > > from mercurial import ( > extensions, > pycompat, > util, > ) > > def extsetup(ui): > def mmapread(orig, fp): > ui.write(b"mmapping %s\n" % pycompat.bytestr(fp.name)) > ui.flush() > return orig(fp) > > extensions.wrapfunction(util, 'mmapread', mmapread) > EOF setting up base repo $ hg init a $ cd a $ touch a $ hg add a $ hg commit -qm base $ for i in `$TESTDIR/seq.py 1 100` ; do > echo $i > a > hg commit -qm $i > done set up verbosemmap extension $ cat << EOF >> $HGRCPATH > [extensions] > verbosemmap=$TESTTMP/verbosemmap.py > EOF mmap index which is now more than 4k long $ hg log -l 5 -T '{rev}\n' --config experimental.mmapindexthreshold=4k mmapping $TESTTMP/a/.hg/store/00changelog.i 100 99 98 97 96 do not mmap index which is still less than 32k $ hg log -l 5 -T '{rev}\n' --config experimental.mmapindexthreshold=32k 100 99 98 97 96 $ cd ..