修改linux清理内存办法

This commit is contained in:
LAOGOU-666
2026-01-12 16:22:38 +08:00
parent 34278a55d6
commit 58de13a609
2 changed files with 3 additions and 8 deletions
+2 -7
View File
@@ -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
+1 -1
View File
@@ -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]