# Why 24/7 AI Browser Agents Leak Memory: Headless Chromium Zombie PIDs, 64 MB /dev/shm Crashes & Hard cgroup Caps

- URL: https://nodebudget.dev/guides/openclaw-memory-leak-browser-automation-limits/
- Author: Yuanqiang Leng (https://github.com/a895047059)
- Updated: 2026-11-26

## TL;DR
Three Linux container defaults quietly break 24/7 AI browser agents like OpenClaw: Docker caps `/dev/shm` at a tiny **64 MB** (crashing Chromium tabs randomly), omitting `init: true` leaves dead Chromium child renderers as zombie processes forever, and uncapped Node/browser pools consume 100% of host RAM. Add `init: true`, `shm_size: "1gb"`, `mem_limit: 3g`, and a 2 GB host swapfile (`vm.swappiness=10`) to keep OpenClaw rock-solid for weeks.

## 1. The 64 MB /dev/shm Crash Nobody Connects to Docker

If your headless browser agent runs fine on your MacBook and then crashes unpredictably on a Linux VPS with `Target closed` or `RESULT_CODE_KILLED_BAD_MESSAGE`, you probably did NOT run out of VPS RAM. By default, Docker mounts `/dev/shm` (POSIX shared memory used heavily by Chromium’s compositor and raster tiles) at **64 MB**—even on a 32 GB server.

The moment an AI agent opens two modern React/SPA tabs or captures a full-page screenshot, Chromium exhausts 64 MB of `/dev/shm` and the renderer process dies violently. Setting `shm_size: "1gb"` in `docker-compose.yml` eliminates this entire class of phantom crashes.

> **Always Add init: true for Any Container Spawning Browsers**: Inside Docker, Node.js runs as PID 1—and Node.js does NOT reap orphaned grandchild processes spawned by Chromium. Over 7 days of continuous browsing, hundreds of `<defunct>` zombie processes pile up until the container hits its PID limit. Adding the 1-line `init: true` (tini) reaps every exited browser child cleanly.

## 2. Hardened OpenClaw / Browser-Agent Compose Block

Combine `init: true`, `shm_size: "1gb"`, explicit `pids_limit: 256`, and `NODE_OPTIONS=--max-old-space-size=2048` so a runaway scrape page can never take down your entire VPS:

```bash
  openclaw:
    image: ghcr.io/openclaw/openclaw:latest
    restart: unless-stopped
    init: true               # Reaps zombie Chromium child processes automatically
    shm_size: "1gb"          # Fixes Docker's 64 MB /dev/shm tab crashes
    mem_limit: 3g
    pids_limit: 256
    environment:
      - NODE_OPTIONS=--max-old-space-size=2048
      - TZ=UTC
```

---
Source: NodeBudget (https://nodebudget.dev) · License: CC BY 4.0 · Disclosure: Some outbound links under /go/* earn affiliate commission. As an Amazon Associate I earn from qualifying purchases.