3 ms·
You can use ulimit to set soft and hard limits for all sorts of system resources (including memory) on Linux.
by jimpudar 7y ago
You can use ulimit to set soft and hard limits for all sorts of system resources (including memory) on Linux.
- azinman2 7y agoTrue — I forgot about this. But can you do that on a process via some config _before_ the process is created?
- jimpudar 7y agoYeah, usually you call ulimit before calling the process. The new process inherits the limits. If you want to modify the limits of an _existing_ process, you can use prlimit.
- IcePic 7y ago..but if the problem is programs not checking malloc() return codes since it will not return failures, then ulimits will in themselves not help the program. It will help the OS to stay alive which is good, but we still need to deal with the programs who expect to run all the way into a swamp and sink without malloc giving them "bad news".