max-memory support for Mac
This commit is contained in:
parent
0f3bc95913
commit
aa3158576a
6
run.py
6
run.py
@ -46,12 +46,12 @@ if os.name == "nt":
|
||||
def limit_resources():
|
||||
if args['max_memory'] >= 1:
|
||||
memory = args['max_memory'] * 1024 * 1024 * 1024
|
||||
if str(platform.system()).lower() == 'linux':
|
||||
import resource
|
||||
resource.setrlimit(resource.RLIMIT_DATA, (memory, memory))
|
||||
if str(platform.system()).lower() == 'windows':
|
||||
import win32api
|
||||
win32api.SetProcessWorkingSetSize(-1, memory, memory)
|
||||
else:
|
||||
import resource
|
||||
resource.setrlimit(resource.RLIMIT_DATA, (memory, memory))
|
||||
|
||||
|
||||
def pre_check():
|
||||
|
Loading…
Reference in New Issue
Block a user