Comfy-Org / Comfy-Org/ComfyUI

total RAM reported wrong in Docker

Open
#5,625 2 comments 2 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

### Expected Behavior

Comfyui should report correct Total RAM based on Docker settings.

### Actual Behavior

ComfyUI reports wrong total RAM, due to it using psutil, which will report the host RAM, and ignores Docker --memory flag.

### Steps to Reproduce

- Run ComfyUI in Docker.
- Set --memory flag to limit memory to a lower amount.
- When starting ComfyUI, it will report the host's total RAM, not the amount set on the Container.
- This also causes smart memory management to fail, as it thinks it has more RAM available than it does, and the OS kills the process when it goes above it.

### Debug Logs

```powershell
Not applicable
```

### Other

This issue is due to ComfyUI using psutil.virtual_memory() to check available memory. PSUtil however uses /proc filesystem to retrieve this info, which reports the host's stats, not the container's.

This could either be solved by some flag use cgroups to retrieve that information, or a simpler flag that limits available memory to a set amount.

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.