
[going back a week here, to dict resizing ...] [Vladimir Marangozov]
... All in all, for performance reasons, dicts remain an exception to the rule of releasing memory ASAP.
Yes, except I don't think there is such a rule! The actual rule is a balancing act between the cost of keeping memory around "just in case", and the expense of getting rid of it. Resizing a dict is extraordinarily expensive because the entire table needs to be rearranged, but lists make this tradeoff too (when you del a list element or list slice, it still goes thru NRESIZE, which still keeps space for as many as 100 "extra" elements around). The various internal caches for int and frame objects (etc) also play this sort of game; e.g., if I happen to have a million ints sitting around at some time, Python effectively assumes I'll never want to reuse that int storage for anything other than ints again. python-rarely-releases-memory-asap-ly y'rs - tim