File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change @@ -121,7 +121,6 @@ def convert_module(
121
121
with io .BytesIO () as engine_bytes :
122
122
engine_bytes .write (serialized_engine )
123
123
serialized_engine = engine_bytes .getvalue ()
124
- breakpoint ()
125
124
return rt_cls (
126
125
serialized_engine = serialized_engine ,
127
126
input_binding_names = list (interpreter_result .input_names ),
Original file line number Diff line number Diff line change @@ -881,3 +881,31 @@ def release_memory() -> None:
881
881
logger .warning ("Failed to release CPU memory." )
882
882
except Exception :
883
883
logger .warning ("Failed to release CPU memory." )
884
+
885
+ elif platform .system () == "Windows" :
886
+ try :
887
+ from ctypes import wintypes as wt
888
+
889
+ kernel32 = ctypes .WinDLL ("kernel32" , use_last_error = True )
890
+ psapi = ctypes .WinDLL ("psapi" , use_last_error = True )
891
+
892
+ GetCurrentProcess = kernel32 .GetCurrentProcess
893
+ GetCurrentProcess .restype = wt .HANDLE
894
+ hProcess = GetCurrentProcess ()
895
+
896
+ EmptyWorkingSet = psapi .EmptyWorkingSet
897
+ EmptyWorkingSet .argtypes = [wt .HANDLE ]
898
+ EmptyWorkingSet .restype = wt .BOOL
899
+ EmptyWorkingSet (hProcess )
900
+
901
+ SetProcessWorkingSetSize = kernel32 .SetProcessWorkingSetSize
902
+ SetProcessWorkingSetSize .argtypes = [
903
+ wt .HANDLE ,
904
+ ctypes .c_size_t ,
905
+ ctypes .c_size_t ,
906
+ ]
907
+ SetProcessWorkingSetSize .restype = wt .BOOL
908
+ SIZE_T_MAX = ctypes .c_size_t (- 1 ).value # 0xFFFFFFFFFFFFFFFF on x64
909
+ SetProcessWorkingSetSize (hProcess , SIZE_T_MAX , SIZE_T_MAX )
910
+ except Exception :
911
+ logger .warning ("Failed to release CPU memory." )
You can’t perform that action at this time.
0 commit comments