I have an important process that the OOM Killer has taken a fancy to with unfortunate results. I would like to make this less likely. All google turns up is stuff like:

echo -1000 > /proc/${PID}/oom_score_adj

while I would like to do it in the program source itself. Is there a library call or syscall to do this, or is my only option getpid(), open(), write() & close() ?

1 Answer 1


There’s no system call, or library function, as far as I’m aware. No need for getpid() though, you can open /proc/self/oom_score_adj directly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.