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] Reduce memory size of tsearch red-black tree.


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


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