I am running a program that is effectively a server, where you enter a job request, the server computes a heavy calculation in a process (using a ProcessPoolExecutor) and then saves the result on the server, which can be retrieved by the user.
Some inputs to the server cause a process to be made which attempts to consume all of the memory. On windows, this doesn't cause the script to crash. On Linux however, it does (and caused the whole server I was running off to crash). Eventually, I would like to make it so that any inputs which will consume all the memory, will be rejected before the process is made. For now, however, I would like to either manage the memory better so that it ran in a similar way to if it was running on Windows or to just kill any process which goes above a threshold memory usage (say, 1 G.B.)
Is there a way to do this?