[issue30306] release arguments of contextmanager
Martin Teichmann
report at bugs.python.org
Mon May 8 10:04:41 EDT 2017
New submission from Martin Teichmann:
The arguments of a function which was decorated to be a context manager are stored inside the context manager, and are thus kept alive.
This is a memory leak.
Example:
@contextmanager
def f(a):
do_something_with(a)
a = None # should release the memory
yield
if this is now called with something big, say
with f(something_really_huge):
pass
then this something_really_huge is kept alive during the with statement, even though the function explicitly let go of it.
----------
components: Library (Lib)
messages: 293234
nosy: Martin.Teichmann
priority: normal
severity: normal
status: open
title: release arguments of contextmanager
type: resource usage
versions: Python 3.7
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30306>
_______________________________________
More information about the Python-bugs-list
mailing list