[Python-Dev] extremely slow exit for program having huge (45G) dict (python 2.5.2)

skip at pobox.com skip at pobox.com
Sat Dec 20 16:55:32 CET 2008


    Steve> Unfortunately there are doubtless programs out there that do rely
    Steve> on actions being taken at shutdown.

Indeed.  I believe any code which calls atexit.register.

    Steve> Maybe os.exit() could be more widely advertised, though ...

That would be os._exit().  Calling it avoids calls to exit functions
registered with atexit.register().  I believe it is both safe, and
reasonable programming practice for modules to register exit functions.
Both the logging and multiprocessing modules call it.  It's incumbent on the
application programmer to know these details of the modules the app uses
(perhaps indirectly) to know whether or not it's safe/wise to call
os._exit().

-- 
Skip Montanaro - skip at pobox.com - http://smontanaro.dyndns.org/


More information about the Python-Dev mailing list