Nodes/MD Nodes/MD: VRAM Canary (Memory Guardian)
ComfyUI Node

MD: VRAM Canary (Memory Guardian)

A ComfyUI node in MD_Nodes/Utility with 6 inputs and 2 outputs.

By MDMAchine·Created about a year ago·Updated 2 months ago· 14
MD: VRAM Canary (Memory Guardian)
  • any_input
  • passthrough
  • vram_stats
vram_threshold_gb2.0
auto_cleanuptrue
gpu_device0
verbose_modefalse
emergency_modefalse
CategoryMD_Nodes/Utility

Inputs (6)

NameTypeDefaultDescription
any_input*UNIVERSAL INPUT • Purpose: The data stream to guard. • Support: Accepts any data type (MODEL, IMAGE, LATENT, etc.). • Effect: Passed through unchanged after the VRAM check completes. ⭐ Recommended: Place immediately before heavy nodes (Upscalers, Samplers).
vram_threshold_gbFLOAT2.00.5–48VRAM THRESHOLD (GB) • Purpose: Triggers cleanup when free VRAM drops below this number. • Trade-offs: Higher values = more aggressive cleanup. Lower values = risk OOM errors. ⭐ Guidelines: - 8GB GPU: 1.5 - 2.0 GB - 12GB GPU: 2.0 - 3.0 GB - 24GB GPU: 3.0 - 4.0 GB
auto_cleanupBOOLEANtrueAUTO CLEANUP • Purpose: Automatically trigger memory cleanup when threshold is breached. • Effect: Executes 'soft_empty_cache' (safe, non-destructive). • Trade-offs: Disable only if actively debugging a suspected memory leak. ⭐ Recommended: Enabled for all production workflows.
gpu_deviceoptINT00–7GPU DEVICE INDEX • Purpose: Selects which GPU to monitor (0 = Primary). • Note: Only relevant for multi-GPU systems. ⭐ Recommended: 0.
verbose_modeoptBOOLEANfalseVERBOSE MODE • Purpose: Show detailed memory statistics in the console. • Effect: Prints before/after cleanup byte comparisons. ⭐ Recommended: False, unless profiling a heavy workflow.
emergency_modeoptBOOLEANfalseEMERGENCY MODE • Purpose: Engages aggressive memory cleanup if triggered. • Effect: Unloads all models from VRAM directly to RAM. • Trade-offs: Slower execution (models must reload), but frees maximum memory. ⭐ Recommended: False, use only for massive 4K+ upscaling.

Outputs (2)

NameTypeDescription
passthrough*
vram_statsSTRING