mirror of
https://github.com/Comfy-Org/ComfyUI_Nvidia_VFX_Nodes.git
synced 2026-11-04 23:37:30 +00:00
[GH-ISSUE #35] RTX VideoSuperResolution node leaks GPU memory per-frame — deadlocks/hangs on long video runs #30
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Comfy-Org/ComfyUI_Nvidia_VFX_Nodes#30
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @CharlesMcquade on GitHub (Jul 28, 2026).
Original GitHub issue: https://github.com/Comfy-Org/ComfyUI_Nvidia_VFX_Nodes/issues/35
What's happening
The
RTXVideoSuperResolutionnode works fine for a single image or a short batch, but when you feed it a longer video (or a batch of ~60+ images) it slowly eats all available GPU memory and then hangs/deadlocks. This is the same underlying problem reported in #16 ("slowly eat up all my system memory… swapping death loop"), just seen from the GPU side.Root cause
In
__init__.py, theexecute()method loops over every frame and callssr.run(input_frame):sr.run()returns a dlpack tensor.torch.from_dlpack(dlpack_out)creates a new GPU tensor that shares the dlpack's underlying storage, and that dlpack reference is reassigned on the next iteration but the previous one is never explicitly freed. Because the converted PyTorch tensor aliases the same memory, the allocator can't reclaim the storage either. Over many frames the per-frame allocations accumulate in the CUDA caching allocator and never get returned, so VRAM climbs monotonically until the node OOMs or deadlocks waiting on a CUDA call.The
.movedim().unsqueeze()ops also produce intermediate views rather than owning their own storage, so the original allocation's lifetime stays pinned to the loop.Reproduction
RTX Video Super Resolutionnode at any scale > 1x.nvidia-smi— it climbs steadily and never drops until the process is killed. On cards with less headroom the node simply hangs partway through.Observed on Ubuntu 24.04, RTX 4080, 48 GB RAM (per #16) and reproduced locally on other configs.
Expected behavior
VRAM usage should stay roughly flat regardless of frame count — each frame's intermediates should be freed before the next frame is processed.
Proposed fix
Three changes to the per-frame loop:
.clone()the converted tensor so the output owns its own storage and the dlpack-backed tensor can be released immediately.delthe dlpack/result/out_frame references explicitly so CPython drops them on this iteration instead of waiting for scope exit.torch.cuda.empty_cache()per frame to return the now-freed blocks to the GPU.I've tested this locally: VRAM stays flat across 100+ frame runs where the original code OOM'd around ~60.
Related: #16. I'll open a PR with this fix shortly.
@kingp0dd commented on GitHub (Aug 21, 2026):
Thank you