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