Skip to content

Commit b8aa4e6

Browse files
committed
Added env variable control
1 parent 4ffb8b3 commit b8aa4e6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

py/torch_tensorrt/dynamo/utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import ctypes
44
import gc
55
import logging
6+
import os
67
import platform
78
import warnings
89
from dataclasses import fields, replace
@@ -882,7 +883,7 @@ def release_memory() -> None:
882883
torch.cuda.ipc_collect()
883884
torch.cuda.synchronize()
884885

885-
if platform.system() == "Linux":
886+
if platform.system() == "Linux" and os.environ.get("TRIM_CPU_MEMORY", "0") == "1":
886887
try:
887888
libc = ctypes.CDLL("libc.so.6")
888889
if libc.malloc_trim(0) != 1:

0 commit comments

Comments
 (0)