(f)
| 2 | import gc |
| 3 | |
| 4 | def check(f): |
| 5 | print('start') |
| 6 | |
| 7 | a = f() |
| 8 | t = type(a) |
| 9 | |
| 10 | print('post-setup') |
| 11 | for obj in gc.get_objects(): |
| 12 | if type(obj) == t: |
| 13 | print(obj) |
| 14 | |
| 15 | del a |
| 16 | |
| 17 | print('post-delete') |
| 18 | for obj in gc.get_objects(): |
| 19 | if type(obj) == t: |
| 20 | print(obj) |
| 21 | |
| 22 | gc.collect() |
| 23 | |
| 24 | print('post-collect') |
| 25 | for obj in gc.get_objects(): |
| 26 | if type(obj) == t: |
| 27 | print(obj) |
| 28 | |
| 29 | print('finish') |
| 30 | |
| 31 | check(lambda: SortedDict({'a': 1, 'b': 2})) |
| 32 |