# How to find out which node has the memory leak?

**URL:** <https://forum.comfy.org/t/how-to-find-out-which-node-has-the-memory-leak/3755>\
**Category:** Custom Nodes\
**Created:** [September 3, 2025, 3:53pm UTC](https://forum.comfy.org/t/how-to-find-out-which-node-has-the-memory-leak/3755 "2025-09-03T15:53:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arunderan](https://avatars.discourse-cdn.com/v4/letter/a/9fc29f/32.png) [@Arunderan](https://forum.comfy.org/u/Arunderan)\
**Post date:** [September 3, 2025, 3:53pm UTC](https://forum.comfy.org/t/how-to-find-out-which-node-has-the-memory-leak/3755/1 "2025-09-03T15:53:09Z")

</div>

Hey my friends,

I have used a workflow to batch upscale videos. It worked fine for months. But recently i always run into an out of memory after the first three or four videos. I can see the ram usage going up after each run. Up to the point where it fails then.

The workflow is pretty simple. You have a load video node. A upscale image node (using model). A upscale Image node to bring the result into final shape. And then it goes already into the Video Combine node.

What i tried so far:  
I reduced the workflow to a single video. And rendered them one by one. Problem persists.  
I added a vram debug node in hope it clears the ram. Problem persists.  
I ran the workflow in a completely new portable installation. Problem persists.

Could somebody give me a hint what to do next please? Which node here is the trouble maker?

Image is workflow:

 ![workflow](https://canada1.discourse-cdn.com/flex009/uploads/comfyui1/original/1X/38dae2c73af4aa6529bee1ab46b8abd89988b734.png)

---

<div class="post-metadata">

**Author:** ![Arunderan](https://avatars.discourse-cdn.com/v4/letter/a/9fc29f/32.png) [@Arunderan](https://forum.comfy.org/u/Arunderan)\
**Post date:** [September 6, 2025, 6:57am UTC](https://forum.comfy.org/t/how-to-find-out-which-node-has-the-memory-leak/3755/2 "2025-09-06T06:57:03Z")

</div>

Okay, the memory leak seems to be in the ComfyUI code. Not the nodes.

I reduced the workflow to just the upscale by model. In a second step i reduced the workflow to just upscale image to 1920 x 1080. So two different solutions with different nodes. And both times i get a out of system memory after a handful runs.

Installed older version of ComfyUI. 0.3.5. Here it simply works fine for even the 50th video. And you can see a massive ram drop after ervery run. And it will finish video 40 like it did with video 1. In newest ComfyUI the same workflow the memory consumption adds and adds and adds, until it throws the oom after a few runs.

Will create a bug report now.

---

<div class="post-metadata">

**Author:** ![Arunderan](https://avatars.discourse-cdn.com/v4/letter/a/9fc29f/32.png) [@Arunderan](https://forum.comfy.org/u/Arunderan)\
**Post date:** [September 6, 2025, 7:54am UTC](https://forum.comfy.org/t/how-to-find-out-which-node-has-the-memory-leak/3755/3 "2025-09-06T07:54:00Z")

</div>

Done. I wish i could be of more help here ☹

> <https://github.com/comfyanonymous/ComfyUI/issues/9739>
>
> \### 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
> 
> Upscaling workflow that works since months just fine. ComfyUI 0.3.5 runs the workflow even after 40 videos without to run out of system ram. The overall ram usage is relatively low. With a short spike to the maximum ram at the image mixing point. 
> 
> After every generation the ram usage drops down to around 5-7 gb. And continues happily then with the next video.
> 
> \### Actual Behavior
> 
> Same workflow. Newest ComfyUI runs out of system ram after a handful runs.
> 
> Very high ram consumption. After every run more and more ram gets consumed. And after a few runs it throws an out of memory error.
> 
> !\[Image\](https://github.com/user-attachments/assets/9ded9fc2-6704-437a-8b1d-5117f00c0f2f)
> 
> \### Steps to Reproduce
> 
> Easiest method with the full workflow and all involved nodes:
> Generate a folder called Input at your drive C
> Throw in a few videos
> Set the nunber of runs to the number of videos.
> Run.
> Since both upscaling nodes are in the workflow, the oom will appear quicker here.
> 
> Full workflow. Image is workflow ...
> 
> \<img width="2526" height="1243" alt="Image" src="https://github.com/user-attachments/assets/e081ffae-d0ab-44b7-a607-5a319619aa2f" /\>
> 
> The more time consuming method: 
> Use the reduced workflow that just uses the Load Upscale Model.
> Load video
> Run
> Load Video
> Run 
> and so on 
> Wait until you run into the oom. This will take a bit longer, since just the one upscaling node is in the workflow.
> 
> \<img width="1483" height="898" alt="Image" src="https://github.com/user-attachments/assets/ee653bbf-6048-4b7d-bcb2-97f76cd660e7" /\>
> 
> Example video. Duplicate it for the tests.
> 
> https://github.com/user-attachments/assets/19e80f36-5f4f-4b76-8468-83b5b18b3994
> 
> \### Debug Logs
> 
> \`\`\`powershell
> H:\\comfy\_blank\\ComfyUI\_windows\_portable\>.\\python\_embeded\\python.exe -s ComfyUI\\main.py --windows-standalone-build
> \[START\] Security scan
> \[DONE\] Security scan
> \## ComfyUI-Manager: installing dependencies done.
> \*\* ComfyUI startup time: 2025-09-06 09:26:36.960
> \*\* Platform: Windows
> \*\* Python version: 3.13.6 (tags/v3.13.6:4e66535, Aug 6 2025, 14:36:00) \[MSC v.1944 64 bit (AMD64)\]
> \*\* Python executable: H:\\comfy\_blank\\ComfyUI\_windows\_portable\\python\_embeded\\python.exe
> \*\* ComfyUI Path: H:\\comfy\_blank\\ComfyUI\_windows\_portable\\ComfyUI
> \*\* ComfyUI Base Folder Path: H:\\comfy\_blank\\ComfyUI\_windows\_portable\\ComfyUI
> \*\* User directory: H:\\comfy\_blank\\ComfyUI\_windows\_portable\\ComfyUI\\user
> \*\* ComfyUI-Manager config path: H:\\comfy\_blank\\ComfyUI\_windows\_portable\\ComfyUI\\user\\default\\ComfyUI-Manager\\config.ini
> \*\* Log path: H:\\comfy\_blank\\ComfyUI\_windows\_portable\\ComfyUI\\user\\comfyui.log
> 
> Prestartup times for custom nodes:
> 2.1 seconds: H:\\comfy\_blank\\ComfyUI\_windows\_portable\\ComfyUI\\custom\_nodes\\ComfyUI-Manager
> 
> Checkpoint files will always be loaded safely.
> Total VRAM 16380 MB, total RAM 32687 MB
> pytorch version: 2.8.0+cu129
> Set vram state to: NORMAL\_VRAM
> Device: cuda:0 NVIDIA GeForce RTX 4060 Ti : cudaMallocAsync
> Using pytorch attention
> Python version: 3.13.6 (tags/v3.13.6:4e66535, Aug 6 2025, 14:36:00) \[MSC v.1944 64 bit (AMD64)\]
> ComfyUI version: 0.3.56
> ComfyUI frontend version: 1.25.11
> \[Prompt Server\] web root: H:\\comfy\_blank\\ComfyUI\_windows\_portable\\python\_embeded\\Lib\\site-packages\\comfyui\_frontend\_package\\static
> \### Loading: ComfyUI-Manager (V3.36)
> \[ComfyUI-Manager\] network\_mode: public
> \### ComfyUI Revision: 208 \[9b151559\] \*DETACHED | Released on '2025-08-31'
> \[ComfyUI-Manager\] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/alter-list.json
> \[ComfyUI-Manager\] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/model-list.json
> \[ComfyUI-Manager\] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/github-stats.json
> \[ComfyUI-Manager\] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/extension-node-map.json
> \[ComfyUI-Manager\] default cache updated: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/custom-node-list.json
> NumExpr defaulting to 16 threads.
> FizzleDorf Custom Nodes: Loaded
> Traceback (most recent call last):
> File "H:\\comfy\_blank\\ComfyUI\_windows\_portable\\ComfyUI\\nodes.py", line 2129, in load\_custom\_node
> module\_spec.loader.exec\_module(module)
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^^^^^^^^
> File "\<frozen importlib.\_bootstrap\_external\>", line 1026, in exec\_module
> File "\<frozen importlib.\_bootstrap\>", line 488, in \_call\_with\_frames\_removed
> File "H:\\comfy\_blank\\ComfyUI\_windows\_portable\\ComfyUI\\custom\_nodes\\drag\_drop\_images\\\_\_init\_\_.py", line 2, in \<module\>
> from .node import DragDropImageViewer
> File "H:\\comfy\_blank\\ComfyUI\_windows\_portable\\ComfyUI\\custom\_nodes\\drag\_drop\_images\\node.py", line 2, in \<module\>
> from nodes import BaseNode # \<-- korrekter Import für die aktuelle Version
> ^^^^^^^^^^^^^^^^^^^^^^^^^^
> ImportError: cannot import name 'BaseNode' from 'nodes' (H:\\comfy\_blank\\ComfyUI\_windows\_portable\\ComfyUI\\nodes.py)
> 
> Cannot import H:\\comfy\_blank\\ComfyUI\_windows\_portable\\ComfyUI\\custom\_nodes\\drag\_drop\_images module for custom nodes: cannot import name 'BaseNode' from 'nodes' (H:\\comfy\_blank\\ComfyUI\_windows\_portable\\ComfyUI\\nodes.py)
> 
> Import times for custom nodes:
> 0.0 seconds: H:\\comfy\_blank\\ComfyUI\_windows\_portable\\ComfyUI\\custom\_nodes\\websocket\_image\_save.py
> 0.0 seconds: H:\\comfy\_blank\\ComfyUI\_windows\_portable\\ComfyUI\\custom\_nodes\\autoresetint
> 0.0 seconds: H:\\comfy\_blank\\ComfyUI\_windows\_portable\\ComfyUI\\custom\_nodes\\comfyui\_auto\_prompt\_schedule
> 0.0 seconds: H:\\comfy\_blank\\ComfyUI\_windows\_portable\\ComfyUI\\custom\_nodes\\comfyui\_text\_line\_combine
> 0.0 seconds (IMPORT FAILED): H:\\comfy\_blank\\ComfyUI\_windows\_portable\\ComfyUI\\custom\_nodes\\drag\_drop\_images
> 0.0 seconds: H:\\comfy\_blank\\ComfyUI\_windows\_portable\\ComfyUI\\custom\_nodes\\mikey\_nodes
> 0.0 seconds: H:\\comfy\_blank\\ComfyUI\_windows\_portable\\ComfyUI\\custom\_nodes\\comfy-image-saver
> 0.0 seconds: H:\\comfy\_blank\\ComfyUI\_windows\_portable\\ComfyUI\\custom\_nodes\\comfyui-custom-scripts
> 0.0 seconds: H:\\comfy\_blank\\ComfyUI\_windows\_portable\\ComfyUI\\custom\_nodes\\comfyui-image-blender
> 0.0 seconds: H:\\comfy\_blank\\ComfyUI\_windows\_portable\\ComfyUI\\custom\_nodes\\derfuu\_comfyui\_moddednodes
> 0.0 seconds: H:\\comfy\_blank\\ComfyUI\_windows\_portable\\ComfyUI\\custom\_nodes\\comfyui-various
> 0.0 seconds: H:\\comfy\_blank\\ComfyUI\_windows\_portable\\ComfyUI\\custom\_nodes\\comfyui-dream-video-batches
> 0.1 seconds: H:\\comfy\_blank\\ComfyUI\_windows\_portable\\ComfyUI\\custom\_nodes\\ComfyUI-Manager
> 0.3 seconds: H:\\comfy\_blank\\ComfyUI\_windows\_portable\\ComfyUI\\custom\_nodes\\comfyui-videohelpersuite
> 0.7 seconds: H:\\comfy\_blank\\ComfyUI\_windows\_portable\\ComfyUI\\custom\_nodes\\comfyui\_fizznodes
> 
> Context impl SQLiteImpl.
> Will assume non-transactional DDL.
> No target revision found.
> Starting server
> 
> To see the GUI go to: http://127.0.0.1:8188
> FETCH ComfyRegistry Data: 5/96
> FETCH ComfyRegistry Data: 10/96
> FETCH ComfyRegistry Data: 15/96
> FETCH ComfyRegistry Data: 20/96
> FETCH ComfyRegistry Data: 25/96
> got prompt
> pop wan\_video\_I2V\_00004.mp4
> got prompt
> got prompt
> got prompt
> got prompt
> got prompt
> got prompt
> got prompt
> got prompt
> got prompt
> got prompt
> got prompt
> got prompt
> got prompt
> got prompt
> got prompt
> got prompt
> got prompt
> got prompt
> got prompt
> got prompt
> got prompt
> got prompt
> got prompt
> FETCH ComfyRegistry Data: 30/96
> got prompt
> got prompt
> got prompt
> got prompt
> got prompt
> got prompt
> got prompt
> got prompt
> got prompt
> got prompt
> got prompt
> got prompt
> got prompt
> got prompt
> got prompt
> got prompt
> FETCH ComfyRegistry Data: 35/96
> FETCH ComfyRegistry Data: 40/96
> FETCH ComfyRegistry Data: 45/96
> FETCH ComfyRegistry Data: 50/96
> FETCH ComfyRegistry Data: 55/96
> FETCH ComfyRegistry Data: 60/96
> FETCH ComfyRegistry Data: 65/96
> FETCH ComfyRegistry Data: 70/96
> FETCH ComfyRegistry Data: 75/96
> FETCH ComfyRegistry Data: 80/96
> FETCH ComfyRegistry Data: 85/96
> FETCH ComfyRegistry Data: 90/96
> FETCH ComfyRegistry Data: 95/96
> FETCH ComfyRegistry Data \[DONE\]
> \[ComfyUI-Manager\] default cache updated: https://api.comfy.org/nodes
> FETCH DATA from: https://raw.githubusercontent.com/ltdrdata/ComfyUI-Manager/main/custom-node-list.json \[DONE\]
> \[ComfyUI-Manager\] All startup tasks have been completed.
> pop wan\_video\_I2V\_00004.mp4
> Prompt executed in 194.27 seconds
> pop wan\_video\_I2V\_00005.mp4
> pop wan\_video\_I2V\_00005.mp4
> Prompt executed in 197.25 seconds
> pop wan\_video\_I2V\_00006.mp4
> pop wan\_video\_I2V\_00006.mp4
> Prompt executed in 194.21 seconds
> pop wan\_video\_I2V\_00007.mp4
> !!! Exception during processing !!! Unable to allocate 27.0 MiB for an array with shape (1152, 2048, 3) and data type float32
> Traceback (most recent call last):
> File "H:\\comfy\_blank\\ComfyUI\_windows\_portable\\ComfyUI\\execution.py", line 496, in execute
> output\_data, output\_ui, has\_subgraph, has\_pending\_tasks = await get\_output\_data(prompt\_id, unique\_id, obj, input\_data\_all, execution\_block\_cb=execution\_block\_cb, pre\_execute\_cb=pre\_execute\_cb, hidden\_inputs=hidden\_inputs)
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> File "H:\\comfy\_blank\\ComfyUI\_windows\_portable\\ComfyUI\\execution.py", line 315, in get\_output\_data
> return\_values = await \_async\_map\_node\_over\_list(prompt\_id, unique\_id, obj, input\_data\_all, obj.FUNCTION, allow\_interrupt=True, execution\_block\_cb=execution\_block\_cb, pre\_execute\_cb=pre\_execute\_cb, hidden\_inputs=hidden\_inputs)
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> File "H:\\comfy\_blank\\ComfyUI\_windows\_portable\\ComfyUI\\execution.py", line 289, in \_async\_map\_node\_over\_list
> await process\_inputs(input\_dict, i)
> File "H:\\comfy\_blank\\ComfyUI\_windows\_portable\\ComfyUI\\execution.py", line 277, in process\_inputs
> result = f(\*\*inputs)
> File "H:\\comfy\_blank\\ComfyUI\_windows\_portable\\ComfyUI\\nodes.py", line 1800, in upscale
> s = comfy.utils.common\_upscale(samples, width, height, upscale\_method, crop)
> File "H:\\comfy\_blank\\ComfyUI\_windows\_portable\\ComfyUI\\comfy\\utils.py", line 885, in common\_upscale
> out = lanczos(s, width, height)
> File "H:\\comfy\_blank\\ComfyUI\_windows\_portable\\ComfyUI\\comfy\\utils.py", line 857, in lanczos
> images = \[torch.from\_numpy(np.array(image).astype(np.float32) / 255.0).movedim(-1, 0) for image in images\]
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
> numpy.\_core.\_exceptions.\_ArrayMemoryError: Unable to allocate 27.0 MiB for an array with shape (1152, 2048, 3) and data type float32
> 
> Prompt executed in 10.21 seconds
> pop wan\_video\_I2V\_00007.mp4
> !!! Exception during processing !!! Unable to allocate 27.0 MiB for an array with shape (1152, 2048, 3) and data type float32
> Traceback (most recent call last):
> File "H:\\comfy\_blank\\ComfyUI\_windows\_portable\\ComfyUI\\execution.py", line 496, in execute
> output\_data, output\_ui, has\_subgraph, has\_pending\_tasks = await get\_output\_data(prompt\_id, unique\_id, obj, input\_data\_all, execution\_block\_cb=execution\_block\_cb, pre\_execute\_cb=pre\_execute\_cb, hidden\_inputs=hidden\_inputs)
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> File "H:\\comfy\_blank\\ComfyUI\_windows\_portable\\ComfyUI\\execution.py", line 315, in get\_output\_data
> return\_values = await \_async\_map\_node\_over\_list(prompt\_id, unique\_id, obj, input\_data\_all, obj.FUNCTION, allow\_interrupt=True, execution\_block\_cb=execution\_block\_cb, pre\_execute\_cb=pre\_execute\_cb, hidden\_inputs=hidden\_inputs)
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> File "H:\\comfy\_blank\\ComfyUI\_windows\_portable\\ComfyUI\\execution.py", line 289, in \_async\_map\_node\_over\_list
> await process\_inputs(input\_dict, i)
> File "H:\\comfy\_blank\\ComfyUI\_windows\_portable\\ComfyUI\\execution.py", line 277, in process\_inputs
> result = f(\*\*inputs)
> File "H:\\comfy\_blank\\ComfyUI\_windows\_portable\\ComfyUI\\nodes.py", line 1800, in upscale
> s = comfy.utils.common\_upscale(samples, width, height, upscale\_method, crop)
> File "H:\\comfy\_blank\\ComfyUI\_windows\_portable\\ComfyUI\\comfy\\utils.py", line 885, in common\_upscale
> out = lanczos(s, width, height)
> File "H:\\comfy\_blank\\ComfyUI\_windows\_portable\\ComfyUI\\comfy\\utils.py", line 857, in lanczos
> images = \[torch.from\_numpy(np.array(image).astype(np.float32) / 255.0).movedim(-1, 0) for image in images\]
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
> numpy.\_core.\_exceptions.\_ArrayMemoryError: Unable to allocate 27.0 MiB for an array with shape (1152, 2048, 3) and data type float32
> 
> 
> \`\`\`
> Note that the log was too long to paste it in full length here. So i have cut off the other error messages with the same content for the rest of the videos.
> 
> \### Other
> 
> I think ComfyUI does simpyl not unload the internally generated images anymore. In 0.3.5 i can see a drop of the memory usage back to 5 to 7 gb after a video is generated. Which is not the case in the current ComfyUI version. There is no drop in ram usage. It sticks at the same ram level and adds from there where in comfyUI 0.3.5 i can see the drop down to 5 gb.
> It is also not node bound. But happens with both, the upscale by model node, and also with the upscale image node.

---

<div class="post-metadata">

**Author:** ![RSa](https://yyz1.discourse-cdn.com/flex009/user_avatar/forum.comfy.org/rsa/32/802_2.png) [@RSa](https://forum.comfy.org/u/RSa)\
**Post date:** [September 14, 2025, 10:59pm UTC](https://forum.comfy.org/t/how-to-find-out-which-node-has-the-memory-leak/3755/4 "2025-09-14T22:59:43Z")

</div>

Just find and report has great value. Let’s wait if they can address it. 🫡
