python shutting down sloooooooowly/tuning dictionaries

Tim Peters tim.one at comcast.net
Wed Apr 21 12:54:14 EDT 2004


[Till]
> Thanks for the suggestions but unfortunately I already tried disabling
> gc. It did not have any noticable effect (not that I was patient
> enough to time it) nor did using sys.exit().

sys.exit() doesn't skip cleanup.  os._exit() does, but you use that at your
own risk (it's probably fine, but you've been warned).

> ...
> To give an example of the actual time spans involved: 2-10 minutes for
> running the program and > 30 minutes for shutdown. During that time
> the amount of memory used by python does not seem to vary.

This sounds like the platform C free() falling into quadratic-time behavior.
You didn't say which version of Python you're using, or which OS + C
runtime, and "stuff like that" varies according to both.  This kind of
behavior is generally much rarer under Python 2.3 than under earlier
Pythons -- but if your platform C malloc/free suck, there's not much more
Python can do about that than 2.3 already does.





More information about the Python-list mailing list