On Fri, Jan 24, 2025 at 15:10:50 +0000, Taylor R Campbell wrote: > > Date: Fri, 24 Jan 2025 16:45:29 +0300 > > From: Valery Ushakov <u...@stderr.spb.ru> > > > > That reminds me... (sorry if hijacking the thread). > > > > 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? > > The right course of action is to define the symbols: > > _malloc_prefork > _malloc_postfork > _malloc_postfork_child > > These zero-argument functions are invoked at the obvious times in > libc's fork() function. There's an example in src/lib/libbsdmalloc. > > (This is obviously NetBSD-specific, but so is any API contract around > overriding the symbols malloc/free and expecting them to be usable > after fork at all.)
Right, but it is not documented and my earlier attempts to solicit feedback for this https://mail-index.netbsd.org/tech-toolchain/2024/11/10/msg004564.html received no replies. PS: As usual, the offer is that I will be glad to fix/clean up any mdoc markup issues if someone updates the man pages with the necessary contents. -uwe