Comfy-Org / Comfy-Org/ComfyUI

OOM error (yes, another one)

Open
#9,830 0 comments 0 reactions 0 assignees View on GitHub
Potential Bug
Dominant language
Python
Stars
133k
Forks
15.7k
Avg merge
1d 6h
Merged PRs (30d)
155

Description

### Custom Node Testing

- [x] I have tried disabling custom nodes and the issue persists (see [how to disable custom nodes](https://docs.comfy.org/troubleshooting/custom-node-issues#step-1%3A-test-with-all-custom-nodes-disabled) if you need help)

### Expected Behavior

No out of memory error

### Actual Behavior

Out of memory

### Steps to Reproduce

Works with any version of ComfyUI to date and any gpu memory amount. The amount just determines how fast you get this OOM.

Assumption: 32GB VRAM.

1. Take the default Krea workflow.
2. In the latent image set the **batch size** to 20.
3. It works all fine.

Now repeat but **change the batch size** to 30. OOM. Perhaps as expected.
Now set the batch size back to 20. Remember, this worked! You get an OOM. This should not happen!

### Debug Logs

```powershell
Irrelevant, it's reproducible with the above under any config.
```

### Other

My assumption here is that setting a batch size somewhere reserves memory that isn't cleaned when you change the batch size. Like when i'd set a batch size of 30 first (which gives the OOM), setting it at 20 again still has the memory allocation of the batch size of 30. Just a guess, i could be wrong.

And yes, this is on a clean comfy with no nodes installed and just the models installed that the workflow needs.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with the default Krea workflow: run batch size 20, then 30 to trigger OOM, then return to 20 without restarting. Investigate how GPU memory is handled when the batch size changes; done means the batch-20 workflow runs again after the failed batch-30 attempt without requiring a restart.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.