Dennis Sweeney <sweeney.dennis...@gmail.com> added the comment:
I reproduced as far back as Python 3.6 with this: ----------------------------------- import gc exc = Exception() deltas = [] for i in range(2, 15): ref1 = len(gc.get_objects()) for j in range(2**i): try: raise exc except Exception: pass ref2 = len(gc.get_objects()) deltas.append(ref2 - ref1) print(deltas) # [4, 8, 16, 9, 64, 128, 256, 512, 1024, 2048, 4072, 8192, 16384] ----------------------------------- Note that the memory does get freed up once the exception is deleted: ----------------------------------- import gc deltas = [] for i in range(2, 15): ref1 = len(gc.get_objects()) exc = Exception() for j in range(2**i): try: raise exc except Exception: pass del exc # <<<<<<<<<<<<<<<<<<<<<<<<<<< ref2 = len(gc.get_objects()) deltas.append(ref2 - ref1) print(deltas) # [0, 0, 0, 0, 0, -14, 0, 0, 0, 0, -14, 0, 0] ----------------------------------- ---------- nosy: +Dennis Sweeney, iritkatriel _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue46717> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com