import resource def limit_memory(bytes): soft, hard = resource.getrlimit(resource.RLIMIT_AS) resource.setrlimit(resource.RLIMIT_AS, (bytes, hard))
2*(2**30) 16*(2**20)
Limit memory set in 2 GiB Limit memory set in 16 MiB