This is the mail archive of the
mailing list for the glibc project.
Re: [PATCH v2] malloc: Remove malloc hooks (Bug 23328)
- From: Florian Weimer <fw at deneb dot enyo dot de>
- To: DJ Delorie <dj at redhat dot com>
- Cc: carlos at redhat dot com, libc-alpha at sourceware dot org, joseph at codesourcery dot com
- Date: Mon, 02 Jul 2018 20:37:17 +0200
- Subject: Re: [PATCH v2] malloc: Remove malloc hooks (Bug 23328)
- References: <firstname.lastname@example.org>
* DJ Delorie:
> Florian Weimer <email@example.com> writes:
>>> + void *(*hook) (size_t, const void *)
>>> + = atomic_forced_read (__glibc_malloc_hook);
>>> + if (__builtin_expect (hook != NULL, 0))
>>> + return (*hook) (sz, RETURN_ADDRESS (0));
>> Should this use atomic_load_relaxed instead?
> It's a copy of what's in malloc/malloc.c
Is supected as much. Oh well.
>>> + HOOK (malloc, NULL);
>> I think you can simplify HOOK considerably if you always initialize
>> all function pointers. Then you don't need to use atomics there
>> because pthread_create always initializes malloc before creating new
> I tried that, but you end up being just as complicated due to having to
> check for "set to dummy hooks", plus implementing the dummy hooks,
> plus... etc. It turned out to not be worth the effort, even once I got
> it working properly (bootstrapping an interposed malloc is not trivial).
Dummy hooks? I meant to initialize not the hooks, but the next_*