After eight months of development the release of the background process , which periodically checks the amount of available memory (MemAvailable, SwapFree) and attempts to proactively respond to memory shortages. The project code is written in C and is under the MIT license.
If the amount of available memory is below a specified value, earlyoom forcibly (by sending SIGTERM or SIGKILL) terminates the process that is consuming the most memory (the one with the highest value in /proc/*/oom_score), without allowing the system to reach a state where its buffers are cleared and hindering swap operation (the OOM (Out Of Memory) handler in the kernel is triggered when the memory shortage condition has already reached critical levels and usually by that point the system is unresponsive to user actions).
Earlyoom supports sending notifications about forcibly terminated processes to the desktop (using notify-send), and also provides the ability to define rules where process names can be specified using regular expressions for which termination is preferred (the "--prefer" option) or should be avoided (the "--avoid" option).
Key in the new release:
- Due to process attributes, the logic for selecting processes to terminate has been accelerated by 50%;
- The UID of the terminated process is logged in addition to the PID and process name;
- A light grey highlight has been added to the debug log;
- Code cleanup has been conducted;
- Where possible, local variable declarations for blocks have been utilized;
- A PATH_LEN setting has been added to replace the hardcoded buffer size value;
- cppcheck is triggered if available;
- A performance test "make bench" has been added;
- The test suite has been expanded (make test);
- The reset of root privileges has been implemented in the systemd unit file earlyoom.service. This change the capability for GUI notifications. To enable GUI notifications, it is suggested to restore root privileges by uncommenting "DynamicUser=true". Disabling root also prevents obtaining memory consumption information when mounting /proc with hidepid=1 or hidepid=2.
Source: opennet.ru
