"ulimit -v" for a daemon and all it's child threads and libraries?
I'm looking for a way to limit the memory of a detached daemon and all of its
child threads/processes including the memory usage of all linked libraries to
avoid server unreachability if all memory gets eaten up.
E.g. an "ulimit -v 5000000" in /etc/apache2/envvars, which is sourced in
/usr/sbin/apache2ctl, seems to define the limit for each thread separately.
(I can start two threads with PHP scripts and both die when reaching the
specified memory amount)
In my example I cannot use Apaches "RLimitMem" because it does not
limit programs executed with PHPs system() nor PHPs "memory_limit" because
it seems not to limit the memory that is used within e.g. libmysqlclient.so.
pam_limits seems unusable, too, as it only works for login shells.