From: Zac Medico Date: Tue, 24 Jun 2008 22:30:48 +0000 (-0000) Subject: Use weakref.WeakValueDictionary to make cached Atom instances eligible for X-Git-Tag: v2.2_rc2~346 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=7c026742048b7b148457f5dcd858b618bf1cad15;p=portage.git Use weakref.WeakValueDictionary to make cached Atom instances eligible for garbage collection when no strong references remain. svn path=/main/trunk/; revision=10772 --- diff --git a/pym/portage/dep.py b/pym/portage/dep.py index 3d3b5d954..41d6b128b 100644 --- a/pym/portage/dep.py +++ b/pym/portage/dep.py @@ -19,6 +19,7 @@ # import re, sys, types +import weakref from itertools import chain import portage.exception from portage.exception import InvalidData, InvalidAtom @@ -412,7 +413,7 @@ class Atom(object): """ __metaclass__ = _AtomCache - _atoms = {} + _atoms = weakref.WeakValueDictionary() _str_methods = ("endswith", "find", "index", "lstrip", "replace", "startswith", "strip", "rindex", "rfind", "rstrip", "__getitem__",