[issue1565525] tracebacks eat up memory by holding references to locals and globals when they are not wanted

Greg Hazel report at bugs.python.org
Sat Jun 26 01:58:01 CEST 2010


Greg Hazel <ghazel at users.sourceforge.net> added the comment:

This is still an issue.

The bug I'm reporting had been explained well, I thought, but I'll repeat it in summary:
There is no way to pass around traceback objects without holding references to an excessive number of objects.

Traceback raising typically does not use these references at all, so having some way to discard them would be very valuable. This allows storing and passing tracebacks between threads (or coroutines or async tasks) without dying quickly due to memory bloat. The simple-minded way to fix this is to allow the user to break the reference themselves.

Fixing this bug would invalidate the need for hacks like the one Twisted has come up with in their twisted.python.Failure object which stringifies the traceback object, making it impossible to re-raise the exception. Failure has a lot of re-implementations of Exceptions and traceback objects as a result.

----------
status: closed -> open
title: gc allowing tracebacks to eat up memory -> tracebacks eat up memory by holding references to locals and globals when they are not wanted
versions: +Python 2.6, Python 2.7

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


More information about the Python-bugs-list mailing list