Hi! I am reading a article by Ginger Bill
https://www.gingerbill.org/articl...memory-allocation-strategies-002/
in the article he describes how to implement a basic Arena Allocator. i thought the code was fairly straightforward, but I had a question about something he did.
| #ifndef DEFAULT_ALIGNMENT
#define DEFAULT_ALIGNMENT (2*sizeof(void *))
#endif
// Because C doesn't have default parameters
void *arena_alloc(Arena *a, size_t size) {
return arena_alloc_align(a, size, DEFAULT_ALIGNMENT);
}
|
as you can see he set DEFAULT_ALIGNMENT to 2 * sizeof(void *). I understand that Processors often operate best when things are aligned to their native Word Size, but why is it that GB chose to set the DEFAULT_ALIGNMENT to 2 * WORD_SIZE?