I am aware of ulimit and I know how to limit memory for a process that I explicitly start, or start using a script. But in this case I have a service that is managed and launched by systemd.
How can I limit its max memory and have it killed (or even better: prevent it from memory allocation (return NULL to malloc
/ realloc
)) when it reaches the memory usage maximum?