diff --git a/README.md b/README.md index f28de17..84ba30a 100644 --- a/README.md +++ b/README.md @@ -82,6 +82,25 @@ When a node has `OUTPUT_IS_LIST = True`: This is ComfyUI's native batching/looping mechanism. +## ⚠️ Memory Management Warning + +**Important:** The simple loop mechanism in this node pack iterates **by node execution**, not by iteration cycle. This means all nodes in the loop execute for each file, which can lead to **Out of Memory (OOM) errors** if proper memory management is not implemented, especially when processing large batches or using memory-intensive operations. + +### Recommendations: + +1. **For Node-Based Loops (using FilePathsForLoop):** + - Use clean VRAM or clean RAM nodes after heavy procedure nodes complete (e.g., after any model loading required nodes like image generation, audio generation, or video generation) + - This ensures proper cleaning and unloading of unneeded models between iterations + - Example: After your image generation node, connect a "Clean VRAM" or "Clean RAM" node before the next iteration + +2. **For Sequential Loops (true iteration cycles):** + - **Recommended:** Use third-party for-loop/while-loop custom nodes for sequential iteration + - Use `LoadFilePathsFromFolder` node to get file count (as loop count) and file names data + - Pass the file count to your third-party loop node to set the iteration count + - Within the loop, connect the current index value to `GetPathByIndex` node + - Connect filenames/filepaths from `LoadFilePathsFromFolder` to `GetPathByIndex` node's inputs + - This approach provides better control over memory management and true sequential processing + ## Example Workflows ### Simple Loop Processing diff --git a/__pycache__/nodes.cpython-312.pyc b/__pycache__/nodes.cpython-312.pyc index c412e13..3b1884d 100644 Binary files a/__pycache__/nodes.cpython-312.pyc and b/__pycache__/nodes.cpython-312.pyc differ