Speeding up Python's exit
Antoine Pitrou
solipsis at pitrou.net
Fri Mar 1 14:10:53 EST 2013
Grant Edwards <invalid <at> invalid.invalid> writes:
>
> > I assume that the memory used by the Python process will be reclaimed
> > by the operating system, but other resources such as opened files may
> > not be.
>
> All open files (including sockets, pipes, serial ports, etc) will be
> flushed (from an OS standpoint) and closed.
According to POSIX, no, open files will not be flushed:
“The _Exit() and _exit() functions shall not call functions registered with
atexit() nor any registered signal handlers. Open streams shall not be flushed.
Whether open streams are closed (without flushing) is implementation-defined.”
http://pubs.opengroup.org/onlinepubs/9699919799/functions/_exit.html
(under the hood, os._exit() calls C _exit())
Regards
Antoine.
More information about the Python-list
mailing list