Fix historical pagination and bound export and proxy memory
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
"""Best-effort return of idle allocator memory after large operations."""
|
||||
import ctypes
|
||||
import gc
|
||||
import sys
|
||||
|
||||
|
||||
def release_idle_memory():
|
||||
gc.collect()
|
||||
if sys.platform == 'linux':
|
||||
try:
|
||||
trim = ctypes.CDLL(None).malloc_trim
|
||||
trim.argtypes = [ctypes.c_size_t]
|
||||
trim.restype = ctypes.c_int
|
||||
return bool(trim(0))
|
||||
except (AttributeError, OSError):
|
||||
pass
|
||||
return False
|
||||
Reference in New Issue
Block a user