Repository navigation
How Terminal Memory Is Measured
The memory details in the status bar have a Terminals section: the sum, then one row per terminal, AI agent or run of the window. The user side is in Memory Use; the app's own readout is in How Memory Is Measured.
The readout counts the app and its web view, not what runs in the terminals. An AI agent such as Claude Code is a big Node.js program, and a dev server or test run started in a terminal can use more memory than the whole app. Without this section the user cannot tell which tab holds it.
sequenceDiagram
participant TM as TerminalMemory.svelte
participant CMD as commands/terminal.rs
participant REG as TerminalRegistry
participant MEM as terminal_memory.rs
loop every 5 s while the details are open
TM->>CMD: terminal_memory
CMD->>REG: window_shells(window label)
REG-->>CMD: (terminal id, shell pid) of this window
CMD->>MEM: usage(shells)
MEM->>MEM: every process with its parent, once
MEM->>MEM: each shell's process tree, summed
MEM-->>TM: terminalId, bytes, processes
end
-
Which terminals.
TerminalRegistry::window_shellsreturns the running shells the asking window owns (terminals, agent tabs and Run tab scripts), so each window lists only what it can name. -
The process tree. A terminal is its shell plus everything below it: the agent,
node,git, a dev server.memory::process_parentslists every process with its parent once per reading. On macOS it readspbi_ppidwithproc_pidinfo(PROC_PIDTBSDINFO); on Windows it reuses the Toolhelp snapshot.process_treewalks down from the shell and takes each pid once, so a stale list with a reused pid cannot loop. -
The bytes. Each process counts like the readout (
memory::process_bytes): the physical footprint on macOS (Activity Monitor), the private working set on Windows (Task Manager). A process that ended between the two steps is left out. Linux returns nothing, so the section stays hidden there, like the readout. -
The rows.
terminalMemoryRows(src/lib/terminal/terminalMemory.ts) matches each result to the window's terminal byterminalId: an agent shows its title and folder, a run its script name, a terminal its tab name. Rows go biggest first; the head shows the sum. Clicking a row shows that terminal withterminalStore.showTerminaland closes the details.
| File | What it does |
|---|---|
src-tauri/src/terminal_memory.rs |
process_tree, usage, the TerminalMemory result |
src-tauri/src/memory.rs |
process_parents and process_bytes for each system |
src-tauri/src/terminal.rs |
TerminalRegistry::window_shells |
src-tauri/src/commands/terminal.rs |
terminal_memory |
src/lib/terminal/terminalMemory.ts |
Rows, sum and tooltips |
src/lib/terminal/TerminalMemory.svelte |
The section in the details |
src/lib/ui/formatBytes.ts |
KB, MB and GB, shared with the readout |
Not part of the app's total. The status bar number stays what Activity Monitor shows for Nibtree. Terminal programs are separate processes the user started, so they get their own sum, and the section says so.
Measured only while the details are open. The section polls every 5 seconds while it is on screen and stops when it closes, so nothing runs in the background. One process list per reading serves every terminal.
One window's terminals. The page can name only its own terminals; other windows show theirs.
-
src-tauri/src/terminal_memory.rs: the tree below a shell, a reused pid that would loop, ended processes left out of the sum, and on macOS and Windows a real shell with children measured. -
src-tauri/src/terminal.rs:closing_a_window_kills_only_its_own_shellsalso checkswindow_shellsper window. -
src/lib/terminal/terminalMemory.test.ts: names and kinds of rows, biggest first, a terminal the window no longer lists, the tab name before an agent has a title, tooltips andformatBytes.
- Update this page and Memory Use when the section or what it counts changes.
- Retake
memory-terminals.pngwhen the details change.
These pages are generated from docs/wiki. To correct something, open a pull request against the source file; edits made here are overwritten.
Using Nibtree
- Getting Started
- Welcome Screen
- Workspaces
- Files Panel
- File Operations
- File Icons
- Rounded Panels
- Editor and Tabs
- Pin Reorder and Wrap Tabs
- Single Tab Title
- Split Editor
- New File and Unsaved Changes
- Unload Hidden Tabs
- Editing Code
- Code Appearance
- Markdown Editor
- Image and PDF Preview
- Search Everywhere
- Recent Files
- Navigation Bar
- Find and Replace
- Changes and Commits
- Sign In Prompts
- Commit Box Layout
- Repository Actions
- Commit Options
- Ignoring Files
- Diffs
- Inline Diffs
- Staging View
- Revert a Change
- Resolving Conflicts
- Merge Tool
- Blame
- History and Log
- Merge Commits
- Branches and Tags
- Branches Popup
- Remotes
- Stashes
- Shelf
- Git Menu
- Git Dialogs
- Interactive Rebase
- Worktrees
- AI Agents
- AI Tasks
- AI Usage
- Keep Computer Awake
- Submodules
- Git LFS
- GitHub
- Git Console
- Terminal
- Terminal Features
- Scripts
- Navigation
- Menus
- Settings
- Settings Search
- Color Themes
- Settings Terminal and Automation
- Settings Files
- Updates
- Status Bar and Help
- Notifications
- Memory Use
- Clear Cache
- MCP and CLI
- Git Mergetool
- Keyboard Shortcuts
- Keyboard Shortcuts Editor
- Troubleshooting
- Troubleshooting Git
Developers
- Developer Guide
- Architecture
- Project Layout
- Backend
- How Folder Watching Works
- Folder Watching Bugs We Fixed
- How Workspace Files Work
- How the Preview Scheme Works
- Backend Services
- How Terminal Features Work
- Terminal Bugs We Fixed
- Frontend
- How the Rich Markdown Editor Works
- Rich Markdown Bugs We Fixed
- Git Menu Links
- Menu Keys and Routing
- Frontend Modules
- Blame Bugs We Fixed
- Project Color And Title Bar
- One Diff View
- Diff Bugs We Fixed
- Merge Tool Layouts
- Merge Tool Bugs We Fixed
- Color Theme Bugs We Fixed
- How the Connected Diff Works
- Rounded Panels Bugs We Fixed
- Update Bugs We Fixed
- Status Bar Bugs We Fixed
- MCP and CLI Bugs We Fixed
- Repository Actions Bugs We Fixed
- How the Changes Tab Works
- CodeMirror Patterns
- How the Cursor Works
- How Editor Features Work
- How the Path Bar Works
- Commands and Events
- Settings Reference
- Commands Workspace and Changes
- Commands Branches and Remotes
- Commands History and Extras
- Commands App and Tools
- Testing
- Test Suites
- Debugging
- Debugging with MCP
- Measuring Setting Memory
- How Terminal Memory Is Measured
- How Markdown Diagrams Work
- Releases and CI
- Publishing the Wiki
- Versioning and Changelog
- Browser Version Packages
- Browser Release Checks
- Docker Image
- Platforms and Signing
- Windows Support
- Windows Bugs We Fixed
- Windows MCP and CLI
- Docs and Screenshots
- UI Library
- UI Library MCP
- UI Library Bugs
- UI Library Migration
- Contributing
How features work
- Welcome screen
- Workspaces and folders
- Files panel
- File operations
- File icons
- Editor and tabs
- Pin, reorder and wrap tabs
- Single tab title
- Split editor
- New File and unsaved changes
- Unload hidden tabs
- Editing code
- Code appearance
- Markdown editor
- Image and PDF preview
- Search Everywhere
- Recent Files
- Navigation Bar
- Find and replace
- Changes and commits
- Sign-in prompts
- Commit box layout
- Repository actions
- Commit options
- Ignoring files
- Diffs
- Inline diffs
- Staging view
- Revert a change
- Resolving conflicts
- Merge tool
- Blame
- History and log
- Merge commits
- Commit tabs
- Branches and tags
- Branches popup
- Remotes
- Stashes
- Shelf
- Git menu
- Git dialogs
- Interactive rebase
- Worktrees
- AI agents
- AI usage
- Keep computer awake
- AI tasks
- Submodules
- Git LFS
- GitHub account
- Git Console
- Back and Forward
- Integrated terminal
- Scripts tool window
- Menu bar
- Settings
- Search in Settings
- Color themes
- Rounded panels
- Updates and release channels
- Status bar and help links
- Notifications
- Memory readout and memory log
- Clear Cache
- MCP server and command line tool
- git mergetool mode