Archived
1
0
Fork 0
This repository has been archived on 2024-04-26. You can view files and clone it, but cannot push or open issues or pull requests.
akari-bot/modules/calc/utils.py
2023-05-28 17:47:37 +08:00

24 lines
869 B
Python

import os
import sys
def do_something():
if sys.version_info.minor > 8 or sys.version_info.micro >= 14: # Added in 3.8.14, 3.7 and below not supported so
sys.set_int_max_str_digits(0)
if os.name == 'posix':
os.nice(15)
import resource
resource.setrlimit(resource.RLIMIT_AS,
(16 * 1024 * 1024, 16 * 1024 * 1024))
resource.setrlimit(resource.RLIMIT_DATA,
(16 * 1024 * 1024, 16 * 1024 * 1024))
resource.setrlimit(resource.RLIMIT_STACK,
(16 * 1024 * 1024, 16 * 1024 * 1024))
elif os.name == 'nt':
import win32process
win32process.SetPriorityClass(win32process.GetCurrentProcess(
), 16384)
win32process.SetProcessWorkingSetSize(
win32process.GetCurrentProcess(), 1, 16 * 1024 * 1024)