Home:ALL Converter>How to limit the maximum memory a process can use in Centos?

How to limit the maximum memory a process can use in Centos?

Ask Time:2017-01-07T00:27:13         Author:Sandesh Veerapur

Json Formatter

I want to limit the maximum memory a process can you in Centos. There can be scenarios where a process ends up using all of the available memory or most of the memory affecting other processes in the system. Therefore, I want to know how this can be limited.

Also, if you can give a sample program where you are limiting the memory usage of a process and show the following scenarios that would be helpful.

  1. Memory allocation successful when requested memory within the set limits.
  2. Memory allocation failed when requested memory above the set limits.

-Thanks

Author:Sandesh Veerapur,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/41509903/how-to-limit-the-maximum-memory-a-process-can-use-in-centos
yy