3 ms·
My problem with the allocaor-api is the "big box" problem. That is, Box<T, A> is a struct containing both a pointer to T and an allocator handle A. With an ar
by cbarrick 4y ago
My problem with the allocaor-api is the "big box" problem.
That is, Box<T, A> is a struct containing both a pointer to T and an allocator handle A.
With an arena allocator, the handle A would be a pointer to the arena. But when using an arena, you don't actually need the box to retain the A after the initial allocation. Deallocation is a no-op; storing A is just wasting 8 bytes.
To get around this, Bumpalo (a prominent arena allocator) defines it's own box type rather than using the std Box. I'm not sure how I feel about that solution.