[PATCH] Reduce memory size of tsearch red-black tree.

Florian Weimer fweimer@redhat.com
Mon Aug 15 18:34:00 GMT 2016


On 08/14/2016 11:15 PM, Mark Wielaard wrote:
> +#ifdef CAN_USE_MALLOC_LOW_BIT
> +  static_assert (alignof (max_align_t) > 1, "malloc must return aligned ptrs");
> +#endif

You should add a runtime check, too, failing if malloc returns an odd 
pointer.  Not all interposed mallocs provide the fundamental alignment, 
unfortunately.

I think you can skip the conditional compilation if you include this 
change.  glibc malloc will always provide this level of alignment, and 
the compile-time conditional will not help with interposed mallocs anyway.

Florian



More information about the Libc-alpha mailing list