[issue1565525] gc allowing tracebacks to eat up memory

STINNER Victor report at bugs.python.org
Wed Jan 14 01:35:03 CET 2009


STINNER Victor <victor.stinner at haypocalc.com> added the comment:

I wrote a patch to support <traceback object>.tb_frame=None. It works 
but the traceback becomes useless because you have unable to display 
the traceback. The frame is used by tb_printinternal() to get the 
filename (co_filename) and the code name (co_name).

I also tried:
    while tbi:
        frame = tbi.tb_frame
        tbi = tbi.tb_next
        frame.f_locals.clear()
        frame.f_globals.clear()

... and it doesn't work because the tbi variable is also removed!

A traceback object have to contain the full frame, but the frame 
contains "big" objects eating your memory. A solution to your initial 
problem (store exceptions) is to not store the traceback object or at 
least to store it as a (list of) string. Solution already proposed by 
loewis (msg29999).

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue1565525>
_______________________________________


More information about the Python-bugs-list mailing list