New submission from Ken Jin <kenjin4...@gmail.com>:
types.Union objects can contain reference cycles, therefore causing memory leaks. E.g.:: ``` import sys, gc from typing import TypeVar gc.collect() for _ in range(10): sys.gettotalrefcount() T = TypeVar('T') U = int | list[T] T.blah = U del T del U gc.collect() ``` Result: 84470 0 84488 0 84504 0 84520 0 84536 0 I'm sending a small PR soon to implement GC methods to fix this. ---------- messages: 396867 nosy: gvanrossum, kj priority: normal severity: normal status: open title: types.Union should support GC versions: Python 3.10, Python 3.11 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue44553> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com