ComfyUI Node

Mac Memory Probe

See exactly where your Mac's unified memory goes (MLX included)

By stratopause-lsc·Created 3 months ago·Updated 3 months ago· 0
Mac Memory Probe
  • input
  • output
  • report
labelprobe

If you run ComfyUI on an M-series Mac, you know the routine: a few runs in, the fans spin up, and then the whole thing dies with an out-of-memory crash. On NVIDIA you'd open nvidia-smi and see the culprit in one glance. On a Mac there's no VRAM to look at - GPU and CPU share one unified memory bank - so you're left guessing whether it was the checkpoint, the batch size, or something else entirely. That's the gap this pack fills, and Mac Memory Probe is its surgical instrument.

It ships from the ComfyUI-MacMemoryMonitor pack (the Mac counterpart to kijai's ComfyUI-MemoryVisualization, rewritten from scratch for unified memory - no shared code). The pack draws a live floating panel of RAM, MPS, MLX, and swap usage; the probe node is the part you drop into a specific spot in your graph to take a snapshot at that exact moment. Same mental model as sticking a print() in your Python script, except it doesn't break the data flow.

What it actually does

The probe is a pass-through. It accepts any wire - image, latent, model, conditioning, whatever - and hands it straight back out, so you can insert it anywhere without touching the rest of your workflow. When it executes, it collects a memory snapshot and prints it to the ComfyUI console, and the node itself shows the report on the canvas. That's it. No magic, and none needed.

The report covers the numbers that matter on a unified-memory machine:

  • Unified RAM used / total, from psutil - the whole-machine truth.
  • MPS driver allocated vs. the "budget" (torch.mps.recommended_max_memory()), plus active tensor memory.
  • MLX Metal active + cache - this is the sneaky one, more below.
  • Swap used / total and the ComfyUI process's RSS.

The MLX thing is the whole point

PyTorch's MPS allocator only sees memory PyTorch allocated. MLX-based nodes like mflux allocate Metal buffers directly, bypassing PyTorch entirely - so torch.mps reads as ~0 and ComfyUI's model manager says "no models loaded" while gigabytes are actually in use. The probe surfaces that hidden memory, and the cache figure in particular is what accumulates across repeated runs and marches toward the OOM cliff.

There's a real design reason the probe exists: MLX uses per-thread GPU streams, and calling its memory functions from the wrong thread throws There is no Stream(gpu, 0) in current thread - an uncatchable abort that takes the whole process down. So the probe, which runs on ComfyUI's execution thread, is the only place it's safe to read MLX live mid-run. (Recent versions also populate the panel's MLX bar when idle, but the probe is still how you get the reading at a precise point while things are actually moving.)

The inputs you'll actually touch

Only two exist. input is required and accepts anything - that's your wire. label is an optional string (default probe) that just names the probe in the console output, so when you've got three of them in a graph you can tell which is which. Outputs are output (your data, unchanged) and report (the snapshot text). Nothing to tune, no wrong settings.

Good spots: right after the KSampler, or between VAE decode stages - the two places memory pressure actually peaks. Want to prove the mflux cache is your problem? Run your workflow twice with a probe after the sampler and compare the two cache lines.

Install

Grab it via ComfyUI Manager (search "ComfyUI-MacMemoryMonitor") or:

cd ComfyUI/custom_nodes
git clone https://github.com/stratopause-lsc/ComfyUI-MacMemoryMonitor

Then restart ComfyUI. No model downloads, and the only dependency beyond what ComfyUI already ships is psutil - which ComfyUI already has. It's intentionally minimal, MIT-licensed.

Gotchas

  • It's a Mac tool. On NVIDIA there's no MPS and no point; this is for Apple Silicon (MPS) machines.
  • torch.mps figures only reflect PyTorch's allocator - other apps using the GPU aren't attributed. For the whole-machine picture, watch the Unified RAM bar. And there's no GPU-utilization/temperature readout; macOS simply doesn't expose a per-process GPU memory API as clean as NVML.
  • If the floating panel renders stale after an update, hard-refresh with ⌘⇧R - the Desktop app's webview caches extension files aggressively, so fully quit and reopen if that doesn't clear it.

The probe won't fix your OOM, but it'll tell you what's eating the memory - which is usually nine-tenths of the fix.

Categoryutils/memory

Inputs (2)

NameTypeDefaultDescription
input*
labeloptSTRINGprobe

Outputs (2)

NameTypeDescription
output*
reportSTRING