I have a Linux daemon that forks a few children and monitors them for crashes (restarting as needed).
It will be great if the parent could monitor the memory usage of child processes – to detect memory leaks and restart child processes when the go beyond a certain size.
How can I do this?
I have a Linux daemon that forks a few children and monitors them for
Share
You should be able to get detailed memory information out of /proc/{PID}/status:
However, unless memory leaks are dramatic, it’s difficult to detect them looking at process statistics, because malloc and free are usually quite abstract from system calls (brk/sbrk) to which they correspond.
You can also check into /proc/${PID}/statm.