4 ms·
> The latter suggestion assumes that there’s enough entropy in the allocation process to make this work. But that’s not guaranteed! Oh absolutely, there's no g
by olliej 4y ago
> The latter suggestion assumes that there’s enough entropy in the allocation process to make this work. But that’s not guaranteed!
Oh absolutely, there's no guarantee it's ever aligned: the allocator could wrap an aligned allocator but include a pointer sized prefix (a la array allocations) so you would be _guaranteed_ to never be more than pointer size aligned :D
As you say versioning and namespacing is super problematic, but I'm not sure they'd even work here.
At it's core the problem is that some code is compiling with the knowledge it has aligned allocations, so can assume alignment, and the some parts are not. There are a bunch of options that ensure that the allocator is consistent, but they devolve to either ignoring the new+delete overrides, or having the aligned allocators detect the override and forward to unaligned allocators while hoping nothing depended on correct alignment.