JohanCDev / Gomoku

🤖 Creation of a bot able to play the Gomoku game. Created in Python with 2 other students. This project is part of my 3rd year at Epitech.
MIT License
2 stars 0 forks source link

Find how to cap used memory to 70 MB #16

Open JohanCDev opened 1 year ago

JohanCDev commented 1 year ago
import resource

def limit_memory(maxsize):
    soft, hard = resource.getrlimit(resource.RLIMIT_AS)
    resource.setrlimit(resource.RLIMIT_AS, (maxsize, hard))
JohanCDev commented 1 year ago

import resource

def limit_memory(maxsize): soft, hard = resource.getrlimit(resource.RLIMIT_AS) resource.setrlimit(resource.RLIMIT_AS, (maxsize, hard))

This only works on linux, there is an other way to do on windows but I wasn't able to implement it