After Termux:Boot fires the boot script, two Dalvik VMs remain running: com.termux (49 MB) and com.termux.boot (40 MB). Together they consume 89 MB — almost as much as system_server. The boot script has already finished, so these VMs serve no purpose. However, only com.termux.boot is safe to kill.
Killing com.termux triggers Android's cgroup cascade: every process in the Termux cgroup (bash, sshd, Node.js gateway, cron) is killed with SIGKILL. The gateway was launched with setsid (Hack #33) which gives it its own session, but it's still in Termux's cgroup because setsid doesn't change cgroup membership.
The cron job uses /system/bin/ps (not Termux's ps, which only shows current-TTY processes):
#!/data/data/com.termux/files/usr/bin/bash
# kill-dalvik.sh — kill com.termux.boot VM
PS=/system/bin/ps
# Only kill if gateway is running (safety check)
if ! $PS 2>/dev/null | grep -q "openclaw-gateway"; then
exit 0
fi
# Kill com.termux.boot only (safe — separate package/cgroup)
$PS 2>/dev/null | grep "com.termux.boot$" | while read _USER PID _REST; do
kill -9 $PID 2>/dev/null
doneInstall the cron job:
# Add to crontab:
$PREFIX/bin/applets/crontab -e
# Add line:
*/2 * * * * $PREFIX/bin/kill-dalvik.sh# Check com.termux.boot processes before:
/system/bin/ps | grep "com.termux.boot"
# Expected: 1-2 processes with ~40 MB
# Wait for cron to run (2 min), then:
/system/bin/ps | grep "com.termux.boot"
# Expected: no output (killed)
# Verify gateway is still running:
pgrep -f openclaw-gateway
# Expected: PID still exists
# Verify com.termux is NOT killed:
/system/bin/ps | grep "com.termux$"
# Expected: still running (we only kill .boot)com.termux — the cgroup cascade kills the gateway, sshd, cron, and everything else. Only com.termux.boot is safe because it's a separate package with its own cgroupps (procps) only shows processes attached to the current TTY. Must use /system/bin/ps which shows all system processesawk doesn't exist in /system/bin/ — use shell builtins (while read) for field extractioncom.termux.boot periodically (service restart policy). The cron job kills it again within 2 minutescom.termux. The lock is managed by the main Termux process| Metric | Before | After |
|---|---|---|
| com.termux.boot RAM | ~40 MB | 0 MB (killed) |
| Kill frequency | Never | Every 2 min |
| Gateway impact | N/A | None (different cgroup) |
| com.termux impact | N/A | Untouched (safe) |