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/15/2016 07:40 PM, Adhemerval Zanella wrote:

+/* Assume malloc returns naturally aligned (alignof (max_align_t))
+   pointers so we can use the low bits to store some extra info.  This
+   works for the left/right node pointers since they are not user
+   visible and always allocated by malloc.  The user provides the key
+   pointer and so that can point anywhere and doesn't have to be
+   aligned.  */
+#define CAN_USE_MALLOC_LOW_BIT 1
+
+#ifndef CAN_USE_MALLOC_LOW_BIT

Why not enforce alignment with memalign/posix_memalign/aligned_alloc and
drop CAN_USE_MALLOC_LOW_BIT?

We just got rid of the need to interpose __libc_memalign along with an external malloc.

tsearch is part of older standards as well, and I don't think these have an aligned allocation interface. I don't think the namespace issue can be resolved easily.

Florian


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