A comprehensive VRAM management solution for ComfyUI that automatically optimizes GPU memory usage and provides real-time monitoring.
- Automatic VRAM cleanup after each queue execution
- Multiple cleaning modes: Standard and Aggressive
- Smart cleaning conditions: Clean every time or only when memory usage is high
- Flexible timing: Clean before queue, after queue, or both
- Manual trigger: Force cleanup with a simple parameter change
- Real-time logging: Monitor all activities in the terminal
- Real-time GPU monitoring with background thread
- Memory usage visualization with color-coded progress bars
- Historical data tracking with configurable history length
- Warning system with customizable thresholds
- Trend analysis showing memory usage patterns
- Multiple outputs for integration with other nodes
- Open ComfyUI Manager
- Search for "StrawberryFist VRAM Optimizer"
- Click Install
- Restart ComfyUI
- Navigate to your ComfyUI custom nodes directory:
cd ComfyUI/custom_nodes/ - Clone this repository:
git clone https://github.com/YourUsername/comfyui-strawberryfist-vram-optimizer.git - Restart ComfyUI
-
Download the latest release from Releases
-
Extract to
ComfyUI/custom_nodes/ -
Restart ComfyUI
-
Example
๐ Automatic Execution Behavior The StFist - VRAM Optimizer node does not require a connection to other nodes in the workflow. Simply placing it anywhere on the canvas will trigger its execution automatically before and/or after each queue run, depending on the selected run_timing setting.
โจ Optimization status is:
Displayed directly in the ComfyUI console output (with timestamps and memory usage details)
Also optionally passed to the status output pin for use with nodes like Show Text
This allows for non-intrusive background optimization without disrupting the workflow structure.
โ Tip: You can place the node in a corner of your workspace for passive VRAM management.
- ComfyUI
- Python 3.8+
- PyTorch with CUDA support
- GPUtil (automatically installed)
- Add the StFist - VRAM Optimizer node to your workflow
- Configure the settings:
- enabled: Turn automatic cleaning on/off
- clear_mode: Choose between Standard or Aggressive cleaning
- auto_clean: Set cleaning conditions (Every Time or Only When High)
- run_timing: Choose when to clean (After Queue, Before Queue, or Both)
- force_run: Change this value to manually trigger cleaning
- Add the StFist - GPU Monitor node to your workflow
- Configure the monitoring settings:
- monitoring_enabled: Turn real-time monitoring on/off
- update_interval: Set monitoring frequency (0.1-10 seconds)
- history_length: Number of data points to keep (10-300)
- warning_threshold: Memory usage warning level (50-95%)
- refresh_trigger: Change to force immediate update
๐ฎ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ฅ StrawberryFist VRAM Optimizer v3.0 [14:23:45]
๐ ์คํ ํ์: 5 | ์ํ: CLEANED_1024.3MB
โ๏ธ ์ค์ : After Queue / Standard
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ GPU ๋ฉ๋ชจ๋ฆฌ ์ํ (NVIDIA GeForce RTX 4090)
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
์ฌ์ฉ๋ฅ : 15.2% (GOOD) โ
โ ๐ ์ฌ์ฉ๋: 3724.1MB / 24564.0MB โ
โ ๐ข๐ข๐ข๐ขโฌโฌโฌโฌโฌโฌโฌโฌโฌโฌโฌโฌโฌโฌโฌโฌโฌโฌโฌโฌโฌ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ฎ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ฅ StrawberryFist GPU ์ค์๊ฐ ๋ชจ๋ํฐ๋ง [14:23:45]
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ GPU: NVIDIA GeForce RTX 4090
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ ๏ธ ์ฌ์ฉ๋ฅ : 75.3% (WARNING) โ
โ ๐ ์ฌ์ฉ๋: 18500.2MB / 24564.0MB โ
โ ๐ก๐ก๐ก๐ก๐ก๐ก๐ก๐ก๐ก๐ก๐ก๐ก๐ก๐ก๐ก๐ก๐ก๐ก๐กโฌโฌโฌโฌโฌโฌ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ ์ต๊ทผ ํต๊ณ (์ต๊ทผ 10๊ฐ ์ํ)
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ํ๊ท : 72.5% | ์ต๋: 89.1% | ์ต์: 65.2% โ
โ ๊ฒฝ๊ณ ์๊ณ๊ฐ: 80.0% โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ ํธ๋ ๋: ๐ ์ฆ๊ฐ ์ถ์ธ
| Parameter | Options | Default | Description |
|---|---|---|---|
| enabled | On/Off | On | Enable/disable automatic VRAM cleaning |
| clear_mode | Standard/Aggressive | Standard | Cleaning intensity level |
| auto_clean | Every Time/Only When High | Every Time | Cleaning trigger condition |
| run_timing | After Queue/Before Queue/Both | After Queue | When to perform cleaning |
| force_run | 0-999 | 0 | Manual trigger (change value to execute) |
| Parameter | Range | Default | Description |
|---|---|---|---|
| monitoring_enabled | On/Off | On | Enable/disable real-time monitoring |
| update_interval | 0.1-10.0 | 1.0 | Update frequency in seconds |
| history_length | 10-300 | 60 | Number of data points to keep |
| warning_threshold | 50.0-95.0 | 80.0 | Memory usage warning percentage |
| refresh_trigger | 0-9999 | 0 | Manual refresh trigger |
The nodes automatically install required dependencies (GPUtil) on first run.
The GPU Monitor runs in a separate thread to provide real-time data without blocking ComfyUI.
Automatically hooks into ComfyUI's queue execution system for seamless VRAM management.
Comprehensive logging system provides detailed information about all operations.
-
"GPU not found" error
- Ensure GPUtil is installed:
pip install GPUtil - Check if your GPU is properly detected by your system
- Ensure GPUtil is installed:
-
VRAM cleaning not working
- Verify PyTorch CUDA support:
torch.cuda.is_available() - Check if CUDA drivers are properly installed
- Verify PyTorch CUDA support:
-
Monitoring not updating
- Increase the update interval
- Check ComfyUI terminal for error messages
If you encounter issues:
- Check the ComfyUI terminal for error messages
- Open an issue on GitHub with detailed information
- Join our community discussions
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- ComfyUI team for the amazing framework
- GPUtil library for GPU monitoring capabilities
- Community feedback and suggestions
Made with โค๏ธ by StrawberryFist | ๐ Optimizing your ComfyUI experience!