[libc-commits] [libc] [libc] Add aligned_alloc (PR #96586)
via libc-commits
libc-commits at lists.llvm.org
Tue Jun 25 16:18:09 PDT 2024
================
@@ -47,10 +48,16 @@ TEST_FOR_EACH_ALLOCATOR(CanAllocate, 2048) {
void *ptr = allocator.allocate(ALLOC_SIZE);
ASSERT_NE(ptr, static_cast<void *>(nullptr));
- // In this case, the allocator should be returning us the start of the chunk.
- EXPECT_EQ(ptr, static_cast<void *>(
- reinterpret_cast<cpp::byte *>(allocator.region_start()) +
- FreeListHeap<>::BlockType::BLOCK_OVERHEAD));
----------------
PiJoules wrote:
>From the changes in this patch, this actually isn't always guaranteed now even for a fresh allocator since the new `MIN_ALLOCATION` is dependent on `max_align_t` which could be larger than the alignment for `BlockType`. In this case, the allocation may no longer be guaranteed to be the very first block.
https://github.com/llvm/llvm-project/pull/96586
More information about the libc-commits
mailing list