You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It might be more correct for the allocator to assert if the size and alignment requested by an allocation don't match the values set at init, if this is supposed to reflect the design in Bill's article about pool allocators.
Though, it looks like Dynamic_Pool allocates chunks, which are then split up as needed, and each allocation within a chunk has a forced alignment. I remember having this issue when I was rewriting the test runner and surveying allocators to use. I'm not wholly sure what the intent here is without some further input.
This specific allocator should imo just be changed to adhere to the requested alignment per allocation, because it has no individual free implementation that should be pretty easy to do.
There are more allocators that are bad like this one, the buddy allocator for example. That allocator does have individual free and I am thinking it should do the same thing as our heap allocator and allocate space for a small header in front of the actual allocation with alignment information, see:
In general, having allocators not respect the requested alignment is bad and we should avoid that in all our allocators, it violates the allocator interface.
Context
Odin: dev-2024-08
OS: Arch Linux, Linux 6.10.7-arch1-1
CPU: Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz
RAM: 15932 MiB
Backend: LLVM 18.1.8
Expected Behavior
The dynamic pool allocator should work with maps by default
Current Behavior
Inserting into a map causes a panic
panic: allocation not aligned to a cache line
from map_alloc_dynamicSteps to Reproduce
The text was updated successfully, but these errors were encountered: