[New-bugs-announce] [issue9825] OrderedDict ref cycles cause memory leak

jason kirtland report at bugs.python.org
Fri Sep 10 21:04:04 CEST 2010

New submission from jason kirtland <jek at discorporate.us>:

Circular graphs of collections.OrderedDict are uncollectable due to the presence of OrderedDict.__del__.

>>> from collections import OrderedDict
>>> import gc
>>> left, right = OrderedDict(), OrderedDict()
>>> left['other'] = right
>>> right['other'] = left
>>> assert not gc.garbage
>>> del left, right
>>> gc.collect()
>>> assert not gc.garbage
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>

Not an issue in 3.1.1, have not verified with 3.1.2.

components: Library (Lib)
files: odicttest.py
messages: 116036
nosy: jek
priority: normal
severity: normal
status: open
title: OrderedDict ref cycles cause memory leak
type: resource usage
versions: Python 2.7, Python 3.2
Added file: http://bugs.python.org/file18834/odicttest.py

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list