Hi. After running a piece of code, I got the following message “Process returned -9 (0x-9) execution time : 1747.012 s”, which confused me.
It is your IDE (the graphical application where you are editing Python code, like IDLE, Pyzo or PyCharm) that adds this informative message with the time elapsed during program execution, and the return code, which is generally zero if everything went okay and non-zero when an error occurred.
So, why is it -9, not -1 or some other number then?
If you’re on a POSIX platform (UNIX, Linux et al), then a negative exit
status from a process indicates that it was terminated with a signal of
that number. -9 would in that situation would indicate signal 9, which
SIGKILL is one of the few uncatchable signals, and is intended as a
fallback for some other process to forcibly terminate your process
(there are permissions around sending signals - you’re not as risk from
random other users).
SIGKILL is also sent by the Linux kernel when it forcably aborts a
process. IIRC, the times I’ve seen this is when the entire system has
run out of memory and the kernel is choosing something to kill to
If your programme had some runaway condition which allocated unbounded
amounts of memory, it might have been considered a candidate for that,
if the system as a whole began to run out of memory before the
per-process memory limits were reached.
Cameron Simpson firstname.lastname@example.org