ComfyUI icon indicating copy to clipboard operation
ComfyUI copied to clipboard

What's with the insane VRAM and RAM usage?

Open zac-market opened this issue 2 months ago • 13 comments

Custom Node Testing

Your question

I am on the latest version of ComfyUI, just updated my portable installation. I have looked for answers but I am just clearly not understanding something here.

I'm trying to run just one of the default MiniMax H3 templates provided off the UI, with their default requested models:

minimax_h3_ref2va_pruned_int8_convrot.safetensors -- 20.5GB~
qwen3vl_32b_minimax_h3_nvfp4_awq.safetensors -- 15.3GB~
minimax_h3_video_vae_fp16.safetensors -- 5GB~
minimax_h3_ref2v_turbo_4step_v0.1_comfyui_bf16.safetensors -- 1.9GB~

I have 64GB of Ram and a 32GB 5090... Somehow this is OOMing my system? Consistently.

I'm not a ComfyUI expert but I have run text generation models from a variety of sources without issue. This should barely be consuming my 32GB GPU memory, let alone my GPU memory and all 64GB of my RAM.

What am I doing wrong here? These numbers just aren't adding up.

More details here: https://github.com/Comfy-Org/ComfyUI/issues/16705#issuecomment-5943711384

Logs


Other

No response

zac-market avatar Oct 01 '26 00:10 zac-market

Unless you provide the log and an actual workflow that is causing your OOM then it's unlikely that anyone can guess what your specific issue is. Lots of people are running workflows with the models you list on lower specced systems successfully so the chances are that it's something to do with the specific assets or settings (e.g. resolution/generation length) that you're using.

ootsby avatar Oct 01 '26 08:10 ootsby

Indeed impossible to answer without logs/workflow, but if I had to guess maybe you don't have pytorch with cu130 which is needed to run the model with all the optimizations.

kijai avatar Oct 01 '26 16:10 kijai

82GB combined VRAM + RAM usage with ComfyUI community provided Ref to Video Minimax H3 workflow. I don't know how much more it would have used because as stated, it OOM-killed around the 80GB+ mark.

This happens with basically the out of the box configuration on a community provided workflow. I have SageAttention installed and enabled but it does it with or without SageAttention.

For the workflow NO references were input. The file loading nodes were bypassed. Only the text input prompt was used with the stock prompt the workflow ships with from the community, about a kid super hero or something. Video duration set to 10 seconds, 0.6 Megapixels.

video_minimax_h3_r2v.json

Image
C:\Windows\System32>nvidia-smi
Thu Oct  1 21:06:02 2026
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 595.97                 Driver Version: 595.97         CUDA Version: 13.2     |
+-----------------------------------------+------------------------+----------------------+
| GPU  Name                  Driver-Model | Bus-Id          Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
|                                         |                        |               MIG M. |
|=========================================+========================+======================|
|   0  NVIDIA GeForce RTX 5090      WDDM  |   00000000:01:00.0  On |                  N/A |
| 43%   37C    P1             64W /  402W |   27533MiB /  32607MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+


D:\code\ComfyUI_windows_portable\python_embeded>python.exe -m pip show torch
Name: torch
Version: 2.13.0+cu130
Summary: Tensors and Dynamic neural networks in Python with strong GPU acceleration
Home-page: https://pytorch.org
Author:
Author-email: PyTorch Team <[email protected]>
License-Expression: Apache-2.0 AND Apache-2.0 WITH LLVM-exception AND BSD-2-Clause AND BSD-3-Clause AND BSL-1.0 AND MIT
Location: D:\code\ComfyUI_windows_portable\python_embeded\Lib\site-packages
Requires: filelock, fsspec, jinja2, networkx, setuptools, sympy, typing-extensions
Required-by: accelerate, clip-interrogator, kornia, open_clip_torch, peft, spandrel, timm, torchsde, torchvision
[ERROR] Error running sage attention: Allocation on device 0 would exceed allowed memory. (out of memory)
Currently allocated     : 24.90 GiB
Requested               : 316.75 MiB
Device limit            : 31.84 GiB
Free (according to CUDA): 3.97 GiB
PyTorch limit (set by user-supplied memory fraction)
                        : 17179869184.00 GiB, using pytorch attention instead.
[ERROR] Error running sage attention: Allocation on device 0 would exceed allowed memory. (out of memory)
Currently allocated     : 24.90 GiB
Requested               : 316.75 MiB
Device limit            : 31.84 GiB
Free (according to CUDA): 3.97 GiB
PyTorch limit (set by user-supplied memory fraction)
                        : 17179869184.00 GiB, using pytorch attention instead.
100%|████████████████████████████████████████████████████████████████████████████████████| 4/4 [00:48<00:00, 12.00s/it]
Windows fatal exception: access violation

Stack (most recent call first):
  File "D:\code\ComfyUI_windows_portable\ComfyUI\comfy\nested_tensor.py", line 34 in <lambda>
  File "D:\code\ComfyUI_windows_portable\ComfyUI\comfy\nested_tensor.py", line 18 in apply_operation
  File "D:\code\ComfyUI_windows_portable\ComfyUI\comfy\nested_tensor.py", line 34 in __truediv__
  File "D:\code\ComfyUI_windows_portable\ComfyUI\comfy\latent_formats.py", line 20 in process_out
  File "D:\code\ComfyUI_windows_portable\ComfyUI\comfy\model_base.py", line 384 in process_latent_out
  File "D:\code\ComfyUI_windows_portable\ComfyUI\comfy\model_base.py", line 2178 in process_latent_out
  File "D:\code\ComfyUI_windows_portable\ComfyUI\comfy_extras\nodes_custom_sampler.py", line 1067 in execute
  File "D:\code\ComfyUI_windows_portable\ComfyUI\comfy_api\latest\_io.py", line 2053 in EXECUTE_NORMALIZED
  File "D:\code\ComfyUI_windows_portable\ComfyUI\comfy_api\internal\__init__.py", line 149 in wrapped_func
  File "D:\code\ComfyUI_windows_portable\ComfyUI\execution.py", line 314 in process_inputs
  File "D:\code\ComfyUI_windows_portable\ComfyUI\execution.py", line 326 in _async_map_node_over_list
  File "D:\code\ComfyUI_windows_portable\ComfyUI\execution.py", line 352 in get_output_data
  File "D:\code\ComfyUI_windows_portable\ComfyUI\execution.py", line 547 in execute
  File "D:\code\ComfyUI_windows_portable\ComfyUI\execution.py", line 789 in execute_async
  File "asyncio\events.py", line 89 in _run
  File "asyncio\base_events.py", line 2060 in _run_once
  File "asyncio\base_events.py", line 683 in run_forever
  File "asyncio\base_events.py", line 712 in run_until_complete
  File "asyncio\runners.py", line 119 in run
  File "asyncio\runners.py", line 196 in run
  File "D:\code\ComfyUI_windows_portable\ComfyUI\execution.py", line 728 in execute
  File "D:\code\ComfyUI_windows_portable\ComfyUI\main.py", line 365 in prompt_worker
  File "threading.py", line 995 in run
  File "threading.py", line 1044 in _bootstrap_inner
  File "threading.py", line 1015 in _bootstrap

D:\code\ComfyUI_windows_portable>echo If you see this and ComfyUI did not start try updating your Nvidia Drivers to the latest. If you get a c10.dll error you need to install vc redist that you can find: https://aka.ms/vc14/vc_redist.x64.exe
If you see this and ComfyUI did not start try updating your Nvidia Drivers to the latest. If you get a c10.dll error you need to install vc redist that you can find: https://aka.ms/vc14/vc_redist.x64.exe

D:\code\ComfyUI_windows_portable>pause
Press any key to continue . . .

zac-market avatar Oct 02 '26 01:10 zac-market

Do you by chance have the VHS nodes installed? I had similar OOMs until I found the reason, see below. Already opened an issue but no reaction so far.

OOM when enabling 'Display animated previews when sampling' https://github.com/Kosinkadink/ComfyUI-VideoHelperSuite/issues/720

Edit: Since I disabled this setting, no OOM anymore and since then, I updated all my video workflows and use Kijai's excellent 'Model Preview Override' node instead:

Image

VRAM-Hoarder avatar Oct 02 '26 07:10 VRAM-Hoarder

Using any startup arguments? And did you try without any custom nodes? That workflow runs on my 4090 as it is just fine:

Image

kijai avatar Oct 02 '26 09:10 kijai

I got the same issue. Can't do WAN or MiniMax without my PC crashing (I don't get an OOM message, just a black screen/driver crash. Only recovery is a complete PC shutdown. Same specs as you 64gb ram and RTX 5090 with 32GB VRAM. See this opened issue: https://github.com/Comfy-Org/ComfyUI/issues/14714

trick72 avatar Oct 02 '26 10:10 trick72

I got the same issue. Can't do WAN or MiniMax without my PC crashing (I don't get an OOM message, just a black screen/driver crash. Only recovery is a complete PC shutdown. Same specs as you 64gb ram and RTX 5090 with 32GB VRAM. See this opened issue: #14714

That doesn't sound like same issue at all, black screen crashing is more likely to be a hardware/driver level issue, running these models with all the optimizations really uses everything out of a GPU in a way most other applications does not. I would make sure drivers are cleanly installed, and possibly try using lower power limit to see if it helps. There isn't really anything to do code wise for such issues.

kijai avatar Oct 02 '26 13:10 kijai

I got the same issue. Can't do WAN or MiniMax without my PC crashing (I don't get an OOM message, just a black screen/driver crash. Only recovery is a complete PC shutdown. Same specs as you 64gb ram and RTX 5090 with 32GB VRAM. See this opened issue: #14714

That doesn't sound like same issue at all, black screen crashing is more likely to be a hardware/driver level issue, running these models with all the optimizations really uses everything out of a GPU in a way most other applications does not. I would make sure drivers are cleanly installed, and possibly try using lower power limit to see if it helps. There isn't really anything to do code wise for such issues.

Personally my machine hasn't had a single crash in like a year after Asrock solidified their bios. Also I run it at a 400W power limit because if I let it go full throttle, yes, it consumes a ton of power and I don't really wanna fry it. My PC doesn't black screen or anything. The software just crashes and it honestly seems like there's some sort of memory leak cause it usually starts to crash more frequently after that even though it has seemingly evicted everything from memory. Usually I do a graceful reboot and its good again for awhile.

Do you by chance have the VHS nodes installed? I had similar OOMs until I found the reason, see below. Already opened an issue but no reaction so far.

I do but it's not used in that workflow so I guess I'm not sure why it'd be an issue.

zac-market avatar Oct 03 '26 00:10 zac-market

@zac-market, VHS does not need to be used in that workflow! It is enough to have it INSTALLED and have that setting enabled. It's a system-wide functionality. Just try to disable "Display animated previews when sampling" like I wrote in the issue ticket at Kosinkadink. It you still get an OOM, it is something else on your side, but I doubt.

Image

VRAM-Hoarder avatar Oct 03 '26 13:10 VRAM-Hoarder

Many people install wrong versions that aren't compatible with their comfy env build. I would suggest you uninstall sageattention and see if the issue is solved. and ensure you're not using sageattention in your workflow. don't worry you can use it again, but this is only to test if sageattention is the problem. if it's, then the solution is to install the correct version of it. python.exe -m pip show sageattention and give us the output. I also still suspecting the workflow you used, even if you say it's the default one. a lot of times i change parameters unknowingly (by dragging the workspace during navigation), so try to provide the workflow and any startup arguments as kijai noted.

xerohaveit avatar Oct 04 '26 21:10 xerohaveit

Try update your GPU driver.

admdev24 avatar Oct 08 '26 13:10 admdev24

I also pasted this to my own thread, but since this is somehow related, I sugges trying it as well:

The fix: --disable-cuda-graphs added to the startup parameters, no crashing anymore I reproduced on torch 2.10.0+cu130 and 2.13.0+cu130, with and without custom nodes, FP8 and GGUF I noticed because Wan2GP on the same machine is stable, so was trying to figure out what the difference is... a lot of trial and error later and this --disable-cuda-graphs was the reason.

trick72 avatar Oct 23 '26 14:10 trick72

This issue is being marked stale because it has not had any activity for 30 days. Reply below within 7 days if your issue still isn't solved, and it will be left open. Otherwise, the issue will be closed automatically.

github-actions[bot] avatar Nov 23 '26 11:11 github-actions[bot]