I've a long-standing problem of a process eating cpu time without doing anything useful, which, most probably, goes like this:
Of a multi-threaded process, one thread is in malloc() while another thread fork()s. (So the child is born with the malloc lock held.) The child process (becoming single-threaded by the fork) calls malloc(). The child loops forever because there's no other thread to release the lock. Strictly speaking, malloc(3) is not declared to be async-signal-safe, so a threaded program shouldn't call malloc() in a child before fork()ing. In my case, the code doing the fork/malloc is the Perl interpreter embedded into collectd, so there's little I can do about it. Couldn't malloc simply install a pthread_atfork() handler that releases the lock in the child?