Memory Diagnostics (Pass-Through)
A Console Spyglass for GPU Memory
- data
- data
Every ComfyUI user has asked the question: where did my VRAM go, and which node ate it? The usual answer involves rerunning the graph while squinting at the console and guessing. This node is the boring, honest fix. Drop it anywhere in a workflow, it passes its input through untouched, and it prints a line of GPU memory stats to the terminal. No model calls, no UI widget, no side effects. It's a spyglass, not a tool.
It's also a quiet departure from the rest of this pack: no flow-matching math, no inversion, nothing to tune. It lives in the Qwen/Diagnostics menu because it's a debugging companion to the inverter nodes, but you can use it in any graph, for any model.
How it works
The source is refreshingly small. The data input uses a wildcard type, so it accepts literally any ComfyUI payload - LATENT, IMAGE, MODEL, anything - and returns the exact same object you fed it. On each run it grabs the active torch device, optionally calls torch.cuda.synchronize() first so in-flight kernels finish and the numbers mean something, then samples the CUDA allocator and prints one line:
[MemoryDiagnostics] device=cuda:0 label=after-inverter allocated=... reserved=... max_allocated=... max_reserved=... free=... total=...
All values in MiB. It also works on Apple Silicon: MPS exposes allocated and reserved counters, though depending on your torch build it may just tell you the counters are unavailable. Either way, your data comes out the other side byte-identical - the console line is the entire feature.
The inputs (there are three; two are optional)
data- anything. In and out unchanged.label(optional string, default empty) - a tag printed in the line. Worth using: "after-inverter" vs "before-ksampler" turns a wall of stats into something you can grep.synchronize(defaultenable) - syncs GPU kernels before sampling so the numbers are accurate. Set it todisableif you want it to never stall the pipeline, even by milliseconds.
Where it earns its keep
With this pack specifically: the inverter runs the full transformer manually under torch.no_grad(), outside a normal sampler context, so it's easy to lose track of whether a Qwen-Image 20B run is about to OOM. Drop a Memory Diagnostics node right after the inverter with synchronize on, and you'll see the real peak (max_allocated / max_reserved) before the sampler even starts. More broadly, this is the node for VRAM-leak hunts - move it along a graph until the allocated figure jumps, and you've found your culprit.
Install
Same as its pack-mates. ComfyUI Manager → search "Qwen Rectified Flow Tools" → install → restart, or:
cd ComfyUI/custom_nodes
git clone https://github.com/ttulttul/ComfyUI-FlowMatching-Inverter
# then restart ComfyUI
Zero extra dependencies, no model downloads, nothing to configure. It appears under Qwen/Diagnostics in the node menu.
One honest caveat: the output is the console, not the canvas. If you want a pretty readout widget on the graph, this isn't it - print() is the whole feature. But that's also its superpower: because it's a pure passthrough with no memory cost and no risk to your data, you can leave it in a shared workflow permanently, and it turns "why did it OOM?" into a question you can actually answer.
Inputs (3)
| Name | Type | Default | Description |
|---|---|---|---|
| data | memory_data | Input to pass through unchanged. | |
| labelopt | STRING | Optional label shown in the log. | |
| synchronizeopt | COMBO | enable | Synchronize GPU kernels before sampling memory. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| data | memory_data | — |