From 58de13a6090e04408e343501ff8902c034d9f518 Mon Sep 17 00:00:00 2001 From: LAOGOU-666 <441059767@qq.com> Date: Mon, 12 Jan 2026 16:22:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9linux=E6=B8=85=E7=90=86?= =?UTF-8?q?=E5=86=85=E5=AD=98=E5=8A=9E=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- __init__.py | 9 ++------- pyproject.toml | 2 +- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/__init__.py b/__init__.py index af1c31e..732a80a 100644 --- a/__init__.py +++ b/__init__.py @@ -2,10 +2,7 @@ import psutil import ctypes from ctypes import wintypes import time -import os import platform -import subprocess -import tempfile import gc from server import PromptServer import comfy.model_management @@ -117,8 +114,8 @@ class RAMCleanup: if system == "Windows": ctypes.windll.kernel32.SetSystemFileCacheSize(-1, -1, 0) elif system == "Linux": - subprocess.run(["sudo", "sh", "-c", "echo 3 > /proc/sys/vm/drop_caches"], - check=False, stderr=subprocess.PIPE, stdout=subprocess.PIPE) + libc = ctypes.CDLL("libc.so.6") + libc.malloc_trim(0) except: pass @@ -140,8 +137,6 @@ class RAMCleanup: try: if system == "Windows": ctypes.windll.kernel32.SetProcessWorkingSetSize(-1, -1, -1) - elif system == "Linux": - subprocess.run(["sync"], check=True) except: pass diff --git a/pyproject.toml b/pyproject.toml index a6dd0a5..f46ffdd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "comfyui_memory_cleanup" description = "A ComfyUI extension that provides nodes for memory cleanup, including VRAM and RAM cleanup functions to optimize ComfyUI performance during long running workflows." -version = "1.1.2" +version = "1.1.3" dependencies = ["psutil"] [project.urls]