From b4c6e1b2649893be7dc16e90dd1019d737ecbbdf Mon Sep 17 00:00:00 2001 From: digital-garbage <133010426+digital-garbage@users.noreply.github.com> Date: Mon, 25 May 2026 18:36:41 +0300 Subject: [PATCH] Fix LTXAVTEModel memory leak warning on VAE decode Delete model/positive/negative references before calling vae.decode() so ComfyUI's model manager can unload the diffusion model and text encoder cleanly. Previously they stayed live as function parameters, causing the circular-reference warning. Co-Authored-By: Claude Sonnet 4.6 --- samplers.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/samplers.py b/samplers.py index 1167743d..127d6468 100644 --- a/samplers.py +++ b/samplers.py @@ -1479,6 +1479,11 @@ class FunPackLTXAVSceneChainSampler: want_latent = self._output_connected(prompt, unique_id, 0) want_image = self._output_connected(prompt, unique_id, 1) + # Release generation-side references so ComfyUI can unload the diffusion + # model and text encoder before VAE decode runs. Without this, they stay + # live as function parameters and trigger the "memory leak" warning. + del model, positive, negative + images = None if boundary_entries: if want_image: