Serhiy Storchaka added the comment: > Serhiy, why is `gc.collect()` returning 2 after `del A` proof of a leak?
Sorry, it was bad example. I don't remember all details. > The problem is that functools.lru_cache is used in _tp_cache. If I remove > type caching, the original "refleak" is fixed. Proposed patch clears caches when search for reference leaks. This decreases the number of leaks. Unpatched: test_typing leaked [3125, 3089, 2897] references, sum=9111 test_typing leaked [1189, 1179, 1103] memory blocks, sum=3471 Patched: test_typing leaked [125, 125, 125] references, sum=375 test_typing leaked [49, 51, 51] memory blocks, sum=151 See also issue23839. ---------- Added file: http://bugs.python.org/file45414/typing-clear-caches.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue28649> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com