[issue6695] PyXXX_ClearFreeList for dict, set, and list

Antoine Pitrou report at bugs.python.org
Sun Aug 16 00:50:45 CEST 2009


Antoine Pitrou <pitrou at free.fr> added the comment:

Le samedi 15 août 2009 à 22:06 +0000, Raymond Hettinger a écrit :
> Raymond Hettinger <rhettinger at users.sourceforge.net> added the comment:
> 
> > The reason is that users expect gc.collect() to make 
> > its best to diminish memory use.
> 
> I thought GC was expected to eliminate reference cycles.

Of course, but it's also the de facto API when wanting to reclaim
memory. The face that a single function call is sufficient is a good
thing in itself.

> Perhaps there ought to be a separate API, such as 
> sys.clear_freelists(), to eliminate other memory use when 
> needed.  Putting this in GC seems like feature creep and
> has negative performance implications (long running programs
> will likely find an immediate need to reallocate the freed
> members).

Performance claims should be substanstiated with actual numbers,
otherwise it's too easy to clutter the API with gratuitous
complications. The impact of reallocating may be negligible, or it might
even be positive if it improves cache locality.

----------

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


More information about the Python-bugs-list mailing list