I am working on a game of Hex in C++ on a Unix platform (Currently running c shell). The AI for my game takes less than a minute to decide on its move (I'm using a sort of Monte Carlo algorithm), and after a few steps, the program terminates on its own, merely printing "Killed" before returning to my command prompt. Does anyone understand what is causing this to happen, and have any suggestions as to how I might go about changing my code to fix it? If it helps at all, I am not using my system. I am connected to my school's server using SSH Secure Shell. I should also point out that I don't think its something wrong with my algorithm because it works as I expect it to until the crash, but it consistently crashes while deciding its 7th move.
This means the process has finished its tasks, so it chooses to terminate. involuntarily: when receiving a signal. This signal can be sent by another user, another process, or Linux itself.
In probability theory — specifically, in stochastic analysis — a killed process is a stochastic process that is forced to assume an undefined or "killed" state at some (possibly random) time.
If the kernel killed a process (because the system ran out of memory), there will be a kernel log message. Check in /var/log/kern.
The kill() function sends a signal to a process or process group specified by pid. The signal to be sent is specified by sig and is either 0 or one of the signals from the list in the <sys/signal. h> header file.
That's the out of memory manager that does that. Most likely you have some sort of memory leak. If you want to continue with the memory leak you can run a script like this in another session. Replace processname with the name of your binary.
#!/bin/bash
while true; do {
pgrep -x "processname" | while read PID; do {
echo -1000 > /proc/$PID/oom_score_adj;
} done;
} done;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With