Mercurial > hg
comparison tests/test-revset.t @ 35501:12a46ad67a3c
smartset: split generatorset classes to avoid cycle
I uncovered a cycle manifesting in a memory leak by running
`hgperfrevset '::tip'`. The cycle was due to generatorset.__init__
assigning a bound method to self.__contains__. Internet sleuthing
revealed that assigning a bound method to an instance attribute
always creates a cycle.
This commit creates two new variants of generatorset for the special
cases of ascending and descending generators. The special
implementations of __contains__ have been extracted to these classes
where they are defined as __contains__.
generatorset now implements __new__ and changes the spawned type to
one of the new classes if needed.
Differential Revision: https://phab.mercurial-scm.org/D1780
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Wed, 27 Dec 2017 11:08:32 -0700 |
parents | 1644623ab096 |
children | beb667c9880f |
comparison
equal
deleted
inserted
replaced
35500:87918218da70 | 35501:12a46ad67a3c |
---|---|
1482 Test scmutil.revsingle() should return the last revision | 1482 Test scmutil.revsingle() should return the last revision |
1483 | 1483 |
1484 $ hg debugrevspec -s 'last(0::)' | 1484 $ hg debugrevspec -s 'last(0::)' |
1485 * set: | 1485 * set: |
1486 <baseset slice=0:1 | 1486 <baseset slice=0:1 |
1487 <generatorset->> | 1487 <generatorsetasc->> |
1488 9 | 1488 9 |
1489 $ hg identify -r '0::' --num | 1489 $ hg identify -r '0::' --num |
1490 9 | 1490 9 |
1491 | 1491 |
1492 Test matching | 1492 Test matching |