[libc-commits] [libc] [libc] Add aligned_alloc (PR #96586)

Paul Kirth via libc-commits libc-commits at lists.llvm.org
Wed Jun 26 09:15:47 PDT 2024


https://github.com/ilovepi commented:

Something I'm realizing should either be tested, or documented as a limitation, is the case where the caller aligns the allocation themselves, by bumping the allocation size up and then aligning the pointer to get the correct alignment. I've seen that pattern in many codebases, even in the Rust core libraries. If the allocator isn't able to free those correctly, we should make sure that is written down somewhere as a limitation. If it is supported, we should test it. I know that usage is often incorrect, but I've seen it enough to know that people will do that, even if `aligned_alloc` is available.

https://github.com/llvm/llvm-project/pull/96586


More information about the libc-commits mailing list