[PATCH 0 of 3] eliminate reference cycles

Simon Heimberg simohe at besonet.ch
Mon Jul 13 09:14:58 CDT 2009


#1 breaks 1 reference cycle in changelog
#2 breaks 1 reference cycle in fncache
In bought places a bound method was assigned to an instance. 

#3 is a test for avoiding new reference cycles
It can show the effect of patches 1 and 2:
bofore #1: inva: collect 8, garbage 0
after: s/8/0/
before #2: repo: collect 15, garbage 0
after: s/15/0/

I hope the test script shows the same output on other computers with different 
python versions. (I use 2.5)
Garbage collection is done several times for better detecting indicating the 
place of the reference cycle. Maybe the test script should be simpler. 
Detecting where the cycle is could be done with a separate tool.

There are still reference cycles in extensions. Many of them are because 
defining a class in a function creates cycles. Example: CLASS.__mro__ has a 
reference to CLASS


More information about the Mercurial-devel mailing list