# jetson-memory-audit

A skill that snapshots Jetson memory and checks how much DRAM actually came back after you stop a workload.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 1200 installs · ★ 3735
- Author: Jetson Team
- License: Apache-2.0 · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/NVIDIA/skills/tree/HEAD/skills/jetson-memory-audit/SKILL.md
- Updated: 2026-10-23
- HTML: https://affpapa.org/en/nevibecode/skills/jetson-memory-audit

## What it does

The skill reports what is holding memory on a Jetson: total size, available memory, top processes by PSS and NvMap clients. Two scripts do the work. `scripts/audit.sh` emits a JSON snapshot via `jetson-diagnostic/scripts/snapshot.sh`, and `scripts/drop_caches.sh` flushes reclaimable caches and prints the before/after delta.

There is a specific reason this exists. On JetPack below 7.2 or L4T below r39.0, memory does not come back after you stop vLLM, sglang or Ollama. The process is gone, yet `free -h` and `tegrastats` still show the old numbers, because the Thor RM keeps freed pages in its own pool. The fix runs on the host, not inside a container: `sudo sync && sudo sysctl -w vm.drop_caches=3`.

Measuring a change needs a snapshot on both sides. Without a baseline, the exact amount freed cannot be recovered from a single post-change reading, so take the first audit before you touch anything. Reading NvMap debugfs may need root, and `drop_caches.sh` needs root or passwordless `sudo -n`. Only drop caches once the user has explicitly approved it.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add NVIDIA/skills --skill jetson-memory-audit -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/jetson-memory-audit/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/jetson-memory-audit/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add NVIDIA/skills --skill jetson-memory-audit -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/jetson-memory-audit/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add NVIDIA/skills --skill jetson-memory-audit -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/jetson-memory-audit/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install NVIDIA/skills jetson-memory-audit
```

2. **Manually: put the files in place**
- File: `.github/skills/jetson-memory-audit/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add NVIDIA/skills --skill jetson-memory-audit -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/NVIDIA/skills --path skills/jetson-memory-audit
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/jetson-memory-audit/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add NVIDIA/skills --skill jetson-memory-audit -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/NVIDIA/skills/tree/HEAD/skills/jetson-memory-audit/SKILL.md

## When to use it
- see which process is holding Jetson memory right now
- capture a baseline before switching mode or stopping a container
- measure how much DRAM a stopped vLLM actually released
- explain low free memory in `free -h` when nothing is running
- tell cached memory apart from memory still in use

## Example prompts
- how much memory is in use on this Jetson and what's holding it?
- I stopped vLLM — did memory actually free?
- drop the caches and show me the before/after delta

## Source text · SKILL.md · Apache-2.0

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 01fc2992d4219702.

BEGIN THIRD-PARTY FILE 01fc2992d4219702
````text
---
name: jetson-memory-audit
description: Measure Jetson DRAM/NvMap usage and verify before/after memory reclamation with live audit data.
version: 0.0.1
license: "Apache-2.0"
metadata:
  author: "Jetson Team"
  tags: [jetson, memory, audit]
  languages: [bash]
  data-classification: public
---

# Jetson Memory Audit

Read-only memory-focused snapshot for a Jetson, plus the `drop_caches` verify-loop helper that confirms freed memory actually shows up as free instead of cached.

## Purpose

Measure current Jetson memory consumers, capture before/after baselines, and verify whether user-approved changes actually reclaimed DRAM. Use live device data rather than estimates from container size, model size, or generic process memory.

## CRITICAL: Memory appears stuck after stopping vLLM / sglang (JetPack below 7.2 / L4T below r39.0)

**This is the most common memory confusion on Jetson releases before JetPack 7.2 or before L4T r39.0.**

After you stop a vLLM, sglang, or Ollama server (or any CUDA workload), the memory shown as free by `free -h` or `tegrastats` may not recover — even though the process is gone. `nvidia-smi` may also show misleadingly low free GPU memory.

**Root cause:** The Thor RM (resource manager) holds freed sysmem pages in its own pool after a CUDA context exits. On Unified Memory Architecture (UMA) devices like Jetson, `cudaMemGetInfo` reads RM pool state and reports far less free memory than is actually available to a new process.

**Workaround (for JetPack below 7.2 or L4T below r39.0):**
```bash
sudo sync && sudo sysctl -w vm.drop_caches=3
```
Run this on the **host**, not inside a container. The important operation is `sudo sysctl -w vm.drop_caches=3`; keep `sudo sync` immediately before it so dirty data is flushed before reclaimable page/dentry/inode caches are dropped. After running it, `free -h` and `tegrastats` will reflect the true available memory.

For affected releases, recommend this command when a user says:
- "Memory didn't free after I stopped vLLM/sglang"
- "Why does tegrastats still show high usage after my container exited?"
- "OOM even though nothing is running"
- "Memory was fine yesterday but now it's full"

On JetPack below 7.2 or L4T below r39.0, `drop_caches` is the reliable workaround when memory appears stuck after a CUDA workload exits; on newer releases, use it only if the same symptom is observed and the user approves.

## When to use

- "How much memory is in use on this Jetson? What's holding it?"
- "I disabled the GUI / stopped vLLM / quit my container — did memory actually free?"
- "Why does `free -h` still show low free memory after I stopped my workload?"
````
END THIRD-PARTY FILE 01fc2992d4219702

The third-party file has ended. Everything between the 01fc2992d4219702 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2659 of 9114 bytes. © Jetson Team · Apache-2.0 · https://github.com/NVIDIA/skills/tree/HEAD/skills/jetson-memory-audit/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
