I am trying to get a step by step process on how to add a limit / reduce memory usage to a specific python program by python script or bash shell. Any ideas would greatly be appreciated.
Issue: I have a python program that consumer up to 80% of my ram usage and I have a 8GB Ram and 10G Swap.
cpulimit is ok but when ever there is a reboot or program restart the PID changes. I am also looking for steps using a Linux / Debian platform.
Though one thing to consider is possibly refactoring the code to use less memory (or other resources.). You can put limits, but that can result in the code not functioning properly if it actual needs those resources to run.