6 ms·
There is a bug here... Clearly the author intended to cache the value of nextmalloc to avoid calling dlsym() on every malloc. The correct code should be: sta
by lgg 3y ago
There is a bug here... Clearly the author intended to cache the value of nextmalloc to avoid calling dlsym() on every malloc. The correct code should be:
static void *(*nextmalloc)(size_t) = NULL;
if (!nextmalloc)
nextmalloc = dlsym(RTLD_NEXT, "malloc");
}
Somehow the fact that the optimization is incorrectly missed here feels appropriate ;-)
- Taniwha 3y agoyeah exactly, calling dlsym on every malloc would kill performance the other bug of course is that it's not thread safe
- deleted 3y ago[deleted]