This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v2] malloc: Remove malloc hooks (Bug 23328)


Florian Weimer <fw@deneb.enyo.de> 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

>> +  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
> threads.

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).


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]