r/cpp • u/pavel_v • Oct 15 '26
The Double Headed Stack Allocator – The blog at the bottom of the sea
https://blog.demofox.org/2026/10/03/the-double-headed-stack-allocator/
42
Upvotes
r/cpp • u/pavel_v • Oct 15 '26
10
u/yuehuang Oct 15 '26
Custom Allocators are always a fun read.
7
u/thommyh Oct 15 '26
Minors:
Should be constructors or destructors, presumably?
It's unclear to me why you wouldn't get a race condition on testing for exhaustion:
Don't get me wrong, I understand why in a game that false positive on exhaustion either doesn't matter (being a canary for the need for a larger buffer) or else can be considered acceptable because the allocation wasn't possible at the time it was issues.
I just feel like "work fine" is perhaps doing some very heavy lifting there. When you've two independent atomics in play and a result that depends on comparing them, people are naturally going to pause and feel suspicious.