[issue9825] OrderedDict ref cycles cause memory leak

jason kirtland report at bugs.python.org
Fri Sep 10 22:19:13 CEST 2010


jason kirtland <jek at discorporate.us> added the comment:

I find the behavior surprising compared to dict and other containers, where this is not an issue and weakrefs are not required in user code.  I would not be surprised, however, to have to wait for a gc.collect() to clean up my cycles like I do for regular objects.

For what it's worth, the pure-python alternative linked in the docs uses neither __del__ nor weakrefs, though it is undoubtably less efficient than this implementation.  And the workaround 'del OrderedDict.__del__' seems to work as well, if one is willing to wait for a gc collection.

----------

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


More information about the Python-bugs-list mailing list