mkill: a memory watchcat
mkill is a Go program that continuously monitors memory usage of the programs
owned by the current user. It kills the program with the sharpest rise in
memory utilization when the overall system memory occupancy goes beyond the
user-configured kill threshold. Download a binary release, or see the source code on Github.

I created mkill because I am handling some programs which tend to run
away with memory use, in a setup which can not be easily sandboxed. It prevents killing a random process, which then usually ends up
killing my remote session on a GCP virtual machine, messing up the ongoing
user workloads. Hence, a monitor program. TUI because I often use text-only
sessions.
The program keeps a running history of memory use to ensure that it does not
kill long-running stable programs. It uses the bubbletea library to create a
top-like TUI (Terminal User Interface) widget which displays processes by
memory use, taking the entire size of the terminal and refreshing every few
seconds. It also features a pane which shows kill candidates, another which
shows which processes have been killed and why, and a pane listing explicitly
protected processes.
Features
- Continuous Monitoring: Scans all processes owned by the current user every 2 seconds acting as a memory watchcat.
- Smart Killing: Triggers only when system memory exceeds the threshold. Identifies “sharp risers” by calculating the rate of memory growth (MB/s) and comparing current usage against a history of the last 10 samples.
- Graceful Termination: Sends
SIGTERMfirst, waits up to 3 seconds, and if the process hasn’t exited, sendsSIGKILL. - Interactive TUI: Top pane for process list, bottom-left pane split between a numbered list of kill candidates and protected processes. The bottom-right pane is split between kill history and a real-time ASCII graph of system memory occupancy. The memory occupancy percentage is color-coded green, orange (near limit), and red (over limit).
- Adjustable Threshold: Press
+or=to increase, or-to decrease the kill threshold interactively. - Process Protection: Press
pwhile selecting a process to add its name to the global protect list, preventing it from ever being killed. PressPto persist this config across sessions (saved to~/.config/mkill/config.json). Protected processes are marked with apin the table. - Manual Kill: Press
kto kill the currently highlighted process. Requires pressingka second time to confirm. - Help Panel: Press
?to toggle a help screen overlay. - Configuration Persistence: Press
Pto save your protected processes list to~/.config/mkill/config.json. These settings are automatically loaded on startup.
Installation
From Release
Download the latest binary for your architecture from the Releases page.
From Source (using Bazel)
bazel build //:mkill
./bazel-bin/mkill_/mkill
From Source (using Go)
go build -o mkill main.go
./mkill
Usage
Simply run the binary:
./mkill