Memory Optimization
A budget for your VRAM, not another filter
- image
- optimized_image
- memory_report
This one doesn't restore or enhance anything - it's a plumbing node. You tell it how much memory you're willing to spend and it manages the processing budget around that number, which matters more than it sounds like in this particular pack. Eric's collection sits some genuinely heavy tools next to lightweight ones - DiffBIR is a full diffusion pipeline, BM3D and Richardson-Lucy are memory-hungry in their own iterative way - and this node is the pressure valve you put in front of (or after) them when your card is the limiting factor.
Why you'd reach for it
If you've ever hit a CUDA out-of-memory error mid-workflow on a big image, you already know the usual fixes: smaller tiles, lower batch size, force CPU. This node bundles that decision into one place with a target instead of making you guess parameters on each individual restoration node. It's the kind of utility that only earns its slot once your workflow has three or four of this pack's heavier nodes chained together and your VRAM is the thing failing, not your settings.
The inputs and outputs that matter
image- required.target_memory_gb(required, 1–24, default 4) - the actual control. Low end (1–2GB) is conservative and slower; the 4–8GB range is the balanced default; push into 8–16GB+ if you have the headroom and want speed.optimization_mode(optional, defaultbalanced) -memory_efficient,balanced, orperformance, trading speed against memory footprint.enable_cleanup(optional, default true) - runs cleanup after processing so the next node in your graph starts with a clean slate rather than inheriting whatever this one left allocated.force_cpu(optional, default false) - the blunt-instrument option: sidesteps GPU memory pressure entirely by not touching the GPU at all. Slow, but it always works.- Outputs:
optimized_imageto pass downstream, andmemory_report- a string telling you what it actually did, worth printing while you're tuningtarget_memory_gb.
How to install it
Search Eric_Image_Processing_Nodes in ComfyUI Manager, or manually:
cd ComfyUI/custom_nodes
git clone https://github.com/EricRollei/Eric_Image_Processing_Nodes
cd Eric_Image_Processing_Nodes
pip install -r requirements.txt
Restart ComfyUI. No model weights to download for this one - it's pure Python/numpy/opencv plumbing, so it's ready the moment the pack imports cleanly. That import itself depends on the pack's core requirements: numpy, opencv-python, scikit-image, scipy, and PyWavelets.
Common issues & troubleshooting
You set target_memory_gb and still OOM'd. This node manages its own processing budget; it can't retroactively shrink a downstream node's tile size or batch count. If the OOM is happening inside a different node in the chain (DiffBIR, BM3D, Richardson-Lucy), you still need to tune that node's own memory-relevant parameters - this one just keeps its footprint predictable.
Forced to CPU and now it's crawling. That's expected - force_cpu trades all your speed for guaranteed stability. Use it as a fallback while you diagnose the real memory ceiling, not as a permanent setting, unless the image is small enough that CPU speed genuinely doesn't matter.
Not sure what number to put in target_memory_gb. As a rule of thumb: check how much VRAM your card actually has free (not total - free), and set the target comfortably under that, leaving room for the model weights and activations of whatever else is running in the same graph. This mirrors the general VRAM guidance for the ComfyUI ecosystem - GPU memory bandwidth is far higher than system RAM, so shuffling data between them to compensate for an undersized target is usually not worth the slowdown.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| image | IMAGE | — | |
| target_memory_gb | FLOAT | 4.01–24 | Target memory usage in GB: • 1-2GB: Conservative (slower) • 4-8GB: Balanced • 8-16GB: Aggressive (faster) • 16GB+: Maximum performance |
| optimization_modeopt | COMBO | balanced | Optimization strategy: • memory_efficient: Minimize memory usage • balanced: Balance speed and memory • performance: Maximize processing speed |
| enable_cleanupopt | BOOLEAN | true | Enable automatic memory cleanup after processing |
| force_cpuopt | BOOLEAN | false | Force CPU processing to avoid GPU memory issues |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| optimized_image | IMAGE | — |
| memory_report | STRING | — |