Antoine Pitrou <solipsis <at> pitrou.net> writes:
>
> We could let the user configure the threshold between the old policy and the
new
> policy. Currently it is hard-wired to a value of 10000 (that is, 10000
> long-lived objects tracked by the GC).
I've removed the threshold in the latest patches because it didn't make much
sense when a few long-lived objects contained a lot of objects not tracked by
the GC.
Another improvement I've included in the latest patches (but which is
orthogonal to the algorithmic change) is that simple tuples and even simple
dicts are not tracked by the GC if they don't need to. A few examples
(gc.is_tracked() is a new function which returns True if an object is tracked
by the GC):
>>> import gc
>>> gc.is_tracked(())
False
>>> gc.is_tracked((1,2))
False
>>> gc.is_tracked((1,(2, "a", None)))
False
>>> gc.is_tracked((1,(2, "a", None, {})))
True
>>> d = {}
>>> gc.is_tracked(d)
False
>>> d[1,2] = 3,4
>>> gc.is_tracked(d)
False
>>> d[5] = None, "a", (1,2,3)
>>> gc.is_tracked(d)
False
>>> d[6] = {}
>>> gc.is_tracked(d)
True
>>> gc.is_tracked(d[6])
False
Regards
Antoine.
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com