tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: using of fork() in multithreaded application



Valery Ushakov <uwe%stderr.spb.ru@localhost> writes:

> When a user-supplied malloc is used (dmalloc &c, or program's own
> malloc like e.g. in inferno-os), they do not override jemalloc fork
> hooks as that's not part of malloc "API contract" so to say.  jemalloc
> hooks are run on fork with unitialized jemalloc internals.
>
> What is the right corse of action here?

I would guess that the jemalloc  pthread_at_fork handlers should only be
installed as part of initialization.

Looking at src/bsd/jemalloc/dist/src/jemalloc.c it seems to be set up in
malloc_init_hard_recursible, so I don't understand how what you say is
happening can happen.  But, I have not tried to read this code since
2010 and odds are I am misreading.

A short reproducer might help.



Home | Main Index | Thread Index | Old Index