r/Compilers • u/FearlessFred • Oct 08 '26
Goose: a stack allocation flat data structure language
https://github.com/aardappel/goose
My latest language is meant to very efficiently let you work with flat pointerless inline data structures allocated on (address space reserved) stack that allow almost data structure creation to be just a pointer bump, with stable pointers.
When used well, it is both safer, faster and uses less memory than the equivalent C++ or Rust.
(see the repo readme for more!)
26
Upvotes
View all comments
Show parent comment
2
u/EstablishmentHour335 Oct 23 '26
Yeah that's exactly my point. It's done automatically for you by the compiler. I've been using my own arena allocator using VirtualAlloc for a long time so I know it's hard to exhaust the address space.
That's not really my concern, my concern is if, each growable array needs it's own VM reservation (this makes sense, they wouldn't be growable unless they were at the end of a stack, otherwise some other allocation into that arena would cut their allocation off and you'd need some kind of linked list). This means that if all stacks are statically determined by the compiler, there is a fex3d number of them and therefore fixed number of growable arrays at a peak (minus stack reuse). Either that, or if I wanted a random count of static arenas, say rand() & 3, the compiler couldn't statically analyze that and you'd need to make more VirtualAlloc calls to allocate more stacks.