1This directory contains test cases that are known to leak references. 2The idea is that you can import these modules while in the interpreter 3and call the leak function repeatedly. This will only be helpful if 4the interpreter was built in debug mode. If the total ref count 5doesn't increase, the bug has been fixed and the file should be removed 6from the repository. 7 8Note: be careful to check for cyclic garbage. Sometimes it may be helpful 9to define the leak function like: 10 11def leak(): 12 def inner_leak(): 13 # this is the function that leaks, but also creates cycles 14 inner_leak() 15 gc.collect() ; gc.collect() ; gc.collect() 16 17Here's an example interpreter session for test_gestalt which still leaks: 18 19>>> from test.leakers.test_gestalt import leak 20[24275 refs] 21>>> leak() 22[28936 refs] 23>>> leak() 24[28938 refs] 25>>> leak() 26[28940 refs] 27>>> 28 29Once the leak is fixed, the test case should be moved into an appropriate 30test (even if it was originally from the test suite). This ensures the 31regression doesn't happen again. And if it does, it should be easier 32to track down. 33