Comfy-Org / Comfy-Org/ComfyUI

Excessive Memory Overcommit on High-RAM Systems

Open
#8,298 10 comments 8 reactions 0 assignees View on GitHub
Potential Bug
Dominant language
Python
Stars
133k
Forks
15.7k
Avg merge
1d 7h
Merged PRs (30d)
158

Description

ComfyUI commits significantly more virtual memory than it actually uses on high-RAM systems. This forces users to maintain unnecessarily large pagefiles and can cause OOM crashes despite abundant available physical memory.

With a 20GB pagefile (80GB total virtual memory), ComfyUI uses 45GB actual memory but commits 75GB virtual memory. The application will crash with OOM errors when committed memory hits 80GB/80GB, even though there's still ~30GB of RAM available to use. It's committing 67% more memory than it needs, it's asking for almost twice as much memory as it actually uses.

It looks like around model_management.py:598, there appears to be a 10% safety margin built in, which on a 64GB system should only add ~6GB (or maybe 8GB if calculated against total virtual memory including pagefile). However, the actual overcommit is 30GB - which represents 46% of my total physical RAM. This suggests percentage-based allocation doesn't scale appropriately for high-memory systems.

Edit: specifically I'm seeing this allocation with Wan native comfyui flow.

### Expected Behavior

More RAM should reduce memory pressure and overcommit

### Actual Behavior

RAM leads to proportionally larger overcommit (67% waste on 64GB system)

### System

[ComfyUI 0.3.35](https://github.com/comfyanonymous/ComfyUI)
[ComfyUI_frontend v1.20.4](https://github.com/Comfy-Org/ComfyUI_frontend)
RAM: 64GB (62GB usable after iGPU allocation)
GPU: RTX 3090 24GB VRAM
OS: Windows 11

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.