Skip to content

v0.5.0 — bounded watch memory (and where the leak actually lives)

Choose a tag to compare

@javimosch javimosch released this 11 Aug 16:33
· 8 commits to main since this release

v0.5 set out to close watch's residual memory growth. It instead proved the growth is not linux-use's — and made it bounded.

The finding

A probe with three callback bodies, every allocation inside an arena block including its own reporting:

callback kB/event
null (only increments a counter) +0.163
props (reads role + name) +0.157
full (+ parent climb) +0.181

A callback that does nothing leaks at the same rate as the full one. The growth is inside libatspi's event delivery on at-spi2-core 2.44, not in this tool. The historical AtspiEventListener leak was fixed upstream in 2.21.1; this is a separate residual.

atspi_accessible_clear_cache() was tried as a mitigation and makes it worse: +0.886 kB/event and roughly half the event throughput.

What v0.5 ships instead

watch --max-rss <kB> — a memory ceiling. Above it, watch exits cleanly with code 90 (rss_limit) after a stderr notice, so a supervisor can restart it and keep streaming:

while :; do
  linux-use watch --app firefox --max-rss 262144 || [ $? -eq 90 ] || break
done

Off by default. At 0.14 kB/event a 256 MB ceiling is roughly 1.8 million events, so most agent workloads never reach it — bound short runs with --duration/--max-events and this never comes up.

Also

  • New exit code 90 rss_limit, documented in guide, help-json and the README.
  • lu_rss_kb() C helper, because machin's read_file returns empty for procfs.
  • No change to the query path; a fresh gnome-calculator still reads in 16 ms (--walk: 72 ms).

Install

curl -L -o linux-use https://github.com/javimosch/linux-use/releases/download/v0.5.0/linux-use-v0.5.0-x86_64-linux
chmod +x linux-use && sudo mv linux-use /usr/local/bin/
sudo apt install libatspi2.0-0 libxtst6 libx11-6 libglib2.0-0
gsettings set org.gnome.desktop.interface toolkit-accessibility true
linux-use doctor && linux-use guide

sha256: 22b57f60db89cdd052021e9c9d0f97a320bec6b19b7a99f12529a42013668105

Docs: https://javimosch.github.io/linux-use/

Full Changelog: v0.4.0...v0.5.0