npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@arthurkim/memtop

v0.0.8

Published

Treemap-based memory monitor for your terminal

Readme

memtop

memtop is a live TUI treemap for Linux and macOS process memory. Instead of showing a flat list of node, python, cargo, browser helpers, and worker processes, it groups memory by the project or app those processes belong to.

224.2 MiB   2.1%  memtop  (~/dev/private/memtop)
 143.9 MiB         codex --yolo
  28.3 MiB         node .../codex
   6.8 MiB         target/debug/memtop --once

memtop demo

Install

Install from npm or pnpm, then run memtop from any shell:

npm install -g @arthurkim/memtop
# or
pnpm install -g @arthurkim/memtop
memtop

Check the installed command:

memtop --version

The npm tarball bundles prebuilt native binaries for:

  • aarch64-apple-darwin
  • x86_64-apple-darwin
  • aarch64-unknown-linux-musl
  • x86_64-unknown-linux-musl

The installed command is a POSIX shell launcher that execs the bundled native binary, so node is not required at runtime after installation.

Usage

Run the live treemap:

memtop

Print a non-interactive snapshot:

memtop --once

Useful filters:

memtop --top-projects 40
memtop --top-processes 16
memtop --min-memory-kib 8192
memtop --interval-ms 1000
memtop --group-by uid

Choose a memory metric:

memtop --metric pss
memtop --metric uss
memtop --metric rss

Why Grouping Matters

Modern development stacks rarely run as one obvious process. A single project can appear as:

  • node
  • cargo
  • python
  • rust-analyzer
  • tsserver
  • worker
  • app bundle helper processes
  • container children

memtop recovers that context before drawing the memory map, so you can see whether a repo, desktop app, browser, container, or worker group is responsible for memory growth.

How Grouping Works

memtop inspects process working directories, command paths, executable paths, macOS app bundles, and container metadata.

It recognizes project markers:

.git
Cargo.toml
package.json
pyproject.toml
go.mod
mise.toml

It also recognizes workspace-style paths:

project
projects
repo
repos
src
workspace
workspaces

On macOS, processes from the same /Applications/*.app, /System/Applications/*.app, /System/Library/CoreServices/*.app, or ~/Applications/*.app bundle are grouped together before repository fallback detection. That keeps apps such as Chrome and their helper processes under one app-level group.

Container metadata takes precedence when a process is known to belong to a container. When the Docker CLI is available, Docker container IDs are resolved to container names and Docker Compose project/service metadata. Docker does not record the host user that launched a container, but memtop displays it when the container has an optional launcher.uid label:

services:
  worker:
    labels:
      launcher.uid: "${LAUNCHER_UID:-}"
LAUNCHER_UID="$(id -u)" docker compose up -d

On Linux, --group-by uid groups processes by the real UID reported in /proc/<pid>/status. In the TUI, press u to toggle between project-aware grouping and UID grouping.

Navigation

| Input | Action | | --- | --- | | Up, Down, k, j | Move through groups or processes | | Enter, z | Zoom into the selected group | | Backspace, x | Return to the group view | | u | Toggle project/UID grouping | | Mouse click | Select a project or process | | r | Refresh now | | q, Esc | Quit |

Memory Metrics

On Linux, pss and uss come from /proc/<pid>/smaps_rollup.

  • pss is usually the best attribution view because it divides shared pages across sharers.
  • rss is fastest, but shared pages can be counted multiple times.
  • uss focuses on private resident memory.

On macOS, the OS does not expose the same PSS/USS accounting through this CLI, so memtop uses RSS while preserving the same TUI and grouping behavior.

--scan-threads controls Linux PSS/USS collection cost. The default 4 keeps CPU usage bounded. Use --scan-threads 0 to use all available parallelism for faster exact snapshots at higher CPU and memory cost.

Limitations

On Linux, the first TUI frame can show inflated memory. This is intentional: when the requested metric is pss or uss, memtop opens with a fast RSS preview, then replaces it with the slower smaps_rollup result in the background.

Example from a real host:

RSS preview: process RSS sum 979.6 GiB, system used 88.1 GiB
PSS refresh: process PSS sum  77.7 GiB, system used 88.7 GiB

The 979.6 GiB preview is not host memory usage. It is the sum of per-process RSS, so shared pages are counted once for every process that maps them. In the same snapshot:

training group: 963.9 GiB RSS -> 63.1 GiB PSS
training worker:  15.0 GiB RSS ->  1.5 GiB PSS
serving group:     2.9 GiB RSS ->  2.0 GiB PSS
serving worker:  692.6 MiB RSS -> 480.1 MiB PSS

The header has two totals with different meanings:

  • system used comes from /proc/meminfo as MemTotal - MemAvailable. This is the kernel's host-wide memory pressure signal.
  • process <metric> sum is the sum of sampled processes above --min-memory-kib. It drives treemap tile sizes. It is an attribution view, so it will not exactly match system used.

Reading Linux smaps_rollup is slower because the kernel must summarize memory mappings for each process. If smaps_rollup cannot be read, that process falls back to RSS.

Development

Run from source:

cargo run

Run a snapshot from source:

cargo run -- --once

You can also use the package scripts as Cargo aliases:

pnpm test
pnpm build

The npm package exposes bin/memtop, a POSIX shell launcher that chooses the bundled vendor/<target>/memtop binary for the current Linux or macOS platform. Source checkouts run through Cargo directly; release packages do not depend on Node.js to start memtop.

Release

Version tags (v*) automatically publish GitHub Releases and @arthurkim/memtop to npm via OIDC trusted publishing.