Skip to content

Commit 34b0671

Browse files
committed
feat: add --total-ram option for controlling visible system RAM in Comfy
Adds a new command-line argument `--total-ram` to limit the amount of system RAM that ComfyUI considers available, allowing users to simulate lower memory environments. This enables more predictable behavior when testing or running on systems with limited resources. Rationale: I run Comfy inside a Docker container. Using `mem_limit` doesn't hide total system RAM from Comfy, so OOM can occur easily. Cache pressure limits cause frequent out-of-memory errors. Adding this flag allows precise control over visible memory.
1 parent f16219e commit 34b0671

File tree

2 files changed

+397
-119
lines changed

2 files changed

+397
-119
lines changed

comfy/cli_args.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ def __call__(self, parser, namespace, values, option_string=None):
9090
parser.add_argument("--oneapi-device-selector", type=str, default=None, metavar="SELECTOR_STRING", help="Sets the oneAPI device(s) this instance will use.")
9191
parser.add_argument("--disable-ipex-optimize", action="store_true", help="Disables ipex.optimize default when loading models with Intel's Extension for Pytorch.")
9292
parser.add_argument("--supports-fp8-compute", action="store_true", help="ComfyUI will act like if the device supports fp8 compute.")
93+
parser.add_argument("--total-ram", type=float, default=0, help="Maximum system RAM visible to comfy in GB (default 0: all)")
9394

9495
class LatentPreviewMethod(enum.Enum):
9596
NoPreviews = "none"

0 commit comments

Comments
 (0)