Goose, Rust, and the Cost of Memory Safety

Goose, Rust, and the Cost of Memory Safety

November 20, 2026 • 13 min read


I've been thinking about what I would want from a programming language if I could use it for almost everything. A native desktop application, an Android or iOS app, a backend service, maybe even WebAssembly. Ideally, most of the code would stay in one language, including the parts that talk to operating-system APIs.

But the more interesting question turned out to be about memory.

I want memory safety without a tracing garbage collector. I don't want reference counts attached to everything either. And I don't want to allocate and free every object manually just to avoid those two approaches.

Rust gets remarkably close. Then I came across Goose, which asks a different question: what if we could change where data lives so that most of the usual memory-management machinery is unnecessary in the first place?

That idea is worth investigating, even if we put the age of the language and the size of its ecosystem aside.

First, Rust already manages memory automatically

There's a common misunderstanding that a language without garbage collection must make the programmer call malloc and free. Rust doesn't work that way.

In ordinary safe Rust, values have owners. When an owner goes out of scope, Rust drops its value. A String or Vec can allocate on the heap, and that allocation is released automatically when the owner is dropped. No tracing collector needs to wake up and find unreachable objects.

Rust does not use reference counting by default, either. Rc and Arc are tools you opt into when shared ownership makes sense. Borrowed references, moves, and ordinary owned values don't require a reference count.

So the objection isn't that Rust fails at memory safety or that it secretly runs a GC. It doesn't.

The friction is in the rules that make this possible. Ownership, borrowing, and aliasing restrictions sometimes force you to rethink how data is connected. A tree, graph, cache, or set of long-lived objects may be easy to draw on paper but awkward to express with direct references in safe Rust. You can use arenas, indices, handles, interior mutability, or reference-counted pointers. Those are useful solutions, but now the shape of the code reflects the ownership strategy as much as the problem itself.

I don't think that makes Rust badly designed. It makes me wonder whether a different memory model could remove some of that work.

What Goose changes

Goose doesn't replace Rust's borrow checker with a garbage collector. It changes the storage model.

According to the Goose language reference, a program uses the native call stack, static data, and a compiler-determined number of data stacks. Dynamic values live in those data stacks instead of a general-purpose heap.

Each data stack is essentially a region of reserved virtual address space with a pointer indicating its current top. When a value grows, the pointer moves forward. When the owning scope ends, the pointer can move back and make the whole region of storage reusable.

Think about building a tree with a million nodes. In a design where each node is separately allocated, creating and destroying the tree involves a lot of allocation and teardown work. If the nodes are laid out together and share a lifetime, the storage can instead be reclaimed in one operation.

Goose makes that kind of allocation central to the language rather than something you build through an arena library.

Its design has several consequences I find especially interesting.

References can survive growth

A Vec in Rust may reallocate when it grows. A reference into the vector's storage cannot simply remain valid across arbitrary growth.

Goose's growable data-stack arrays don't move their existing elements during growth. That means references into them can stay valid for the permitted lifetime of the array. The compiler checks those lifetimes, but it doesn't impose Rust's exclusive mutable-borrow rule.

This is useful for structures with lots of links between elements. You don't always have to replace a natural reference with an integer index just because the collection may grow.

Nested values can stay inline

In Rust, a Vec<String> usually means a vector of string headers, with each string's contents potentially stored in its own allocation.

Goose has variable-size values and container layouts designed to keep nested data together. An array of strings, or a record containing variable-size fields, can occupy one contiguous region.

That can reduce allocation overhead, pointer chasing, and memory used for metadata. It can also improve locality, which often matters more than a small difference in instruction count.

Goose also supports compact relative references. A link can be stored as an offset instead of a full machine address, which is useful for compact trees and relocatable serialized structures.

Reclamation doesn't need a collector or per-object destruction

This is the part that initially caught my attention.

For Goose-owned data, there is no general heap allocator, tracing GC, reference-counting scheme, or destructor walk. The compiler proves where values may live and how long references to them can remain valid. Scope exit can then rewind a data stack.

In other words, allocation and reclamation are automatic, but the runtime doesn't need to discover which arbitrary heap objects are still alive.

There is an important qualification: the memory becomes reusable; that doesn't necessarily mean every reserved or committed page is immediately returned to the operating system. Those are different things.

And Goose does still check memory safety. It just proves different properties from the ones Rust's borrow checker proves. Avoiding Rust-style borrowing syntax is not the same as having no lifetime rules at all.

Where the simplicity gets expensive

The more I read, the clearer it became that Goose isn't giving away free performance. Its model depends on restrictions.

Values on a data stack must follow an order that allows the stack to be rewound safely. The compiler also limits how resizable values are placed. You can't create completely arbitrary independent heap-object lifetimes and expect the same simple reclamation model to handle them.

The language offers pools for data that needs to outlive a local scope or be reused independently. That's helpful, but now the programmer has to decide where those pools live and when slots can be reused.

There is a subtle problem here. Goose documents cases where a reference to a returned pool slot can later observe a different valid value placed into that slot. That doesn't become a dangling pointer or corrupt memory, but it can still be a logic bug. Memory safety is not the same as object identity safety.

Other restrictions are more visible in API design. Goose does not provide ordinary runtime function pointers, escaping closures, or general dynamic dispatch in the way Rust does. Recursive functions cannot hold growable local data across a recursive call. Whole-program compilation is part of the current design.

These aren't all missing library features waiting for somebody to implement them. Several follow from the assumptions that make Goose's storage model efficient.

And while Goose automatically reclaims its own storage, that is not the same as automatically closing every external resource. A native library's file handle, GPU resource, or callback registration may still need explicit cleanup. Rust's Drop mechanism is particularly useful here.

This is the actual trade-off: Goose makes a specific class of memory layouts remarkably straightforward, partly by making other classes of programs harder or impossible to express directly.

Can't Rust already do arena allocation?

Yes. Libraries such as bumpalo provide fast bump allocation and bulk reclamation in Rust.

But I don't think that makes Goose's design redundant.

In Rust, an arena is one possible strategy inside a broader ownership system. You must choose it, work within its API, and still reason about how references to arena data interact with lifetimes and mutation. Reclaiming an arena also doesn't automatically run every value's Drop implementation, so resource cleanup needs care.

In Goose, the data-stack model is built into the language, and the compiler can make guarantees about growth, placement, and reference validity specifically for it.

Rust's strength is flexibility. It lets you mix ordinary heap allocation, arenas, custom allocators, reference counting when necessary, and data structures with independent lifetimes.

Goose's strength is making one unusually efficient approach feel like the default.

So if the question is whether Goose has found a simpler way to manage memory for compatible workloads, I think the answer is yes. If the question is whether it can replace all the ways Rust manages memory without losing expressiveness, the answer is no.

What about the performance numbers?

The Goose project has published a 16-benchmark suite against C++ and safe Rust.

In its October 16, 2026 run, Goose's clang-backed builds were reported to be 1.19 times as fast as the best safe Rust implementations by geometric mean, with 1.25 times less peak memory in the aggregate comparison.

Those are interesting results, especially in benchmarks involving compact records, nested values, and structures that benefit from cheap bulk reclamation.

But they need context. These are project-maintained benchmarks on one machine, measuring whole-process time. The suite compares different implementations of the same workloads, and the published aggregate can select different variants for speed and memory. Some individual benchmarks favor Rust.

I wouldn't turn those results into the claim that Goose is universally faster. What they do show is that the memory-layout ideas are worth measuring in real programs.

The bigger lesson is that fewer allocations, fewer indirections, and simpler teardown can matter just as much as the speed of the allocator itself.

Then why was Kotlin in the conversation?

Because my original goal wasn't only to explore memory models. It was to build actual applications across platforms without constantly switching languages.

Kotlin makes an excellent case for that goal. Kotlin Multiplatform can share substantial code across Android, iOS, desktop, and web. Kotlin/Native provides Apple framework and C interoperability, and Compose Multiplatform offers a shared UI approach.

But Kotlin/Native uses a tracing garbage collector. Its normal desktop Compose target runs on the JVM, which is also garbage collected. Kotlin/Wasm also relies on WasmGC.

Those facts don't make Kotlin slow or unsuitable for applications. They just disqualify it from the specific memory model I'm looking for.

If the requirement is strictly no tracing GC and no reference-count-based object management, Kotlin is not an alternative to Goose or Rust.

Native APIs are a separate problem

A language can generate native machine code and still be awkward for native applications.

Operating systems don't share one universal API. Android has platform APIs designed around its managed runtime. Apple exposes large native frameworks through Swift and Objective-C conventions. Windows has its own interfaces. A C ABI makes many lower-level APIs easier to call, but not every platform service fits neatly behind a C function.

Goose compiles through C and supports C interoperability. That opens a useful door, but its own documentation says callbacks and variadic C functions can require small C adapters. Calling a native library is not the same as having complete, ergonomic, safe bindings for every feature of an operating system.

Rust has a much broader set of native bindings and application frameworks. You can keep a great deal of code in Rust, including application logic and custom APIs, but mobile UI integration and certain platform services may still require platform-specific glue.

Kotlin is particularly convenient on Android and has good integration with Apple frameworks. That reduces language switching for application development, but it doesn't change its memory-management trade-off.

This matters because one source language and zero cross-language boundaries are different promises. I would aim for the first, not assume the second.

WebAssembly is where Goose hits a deeper problem

Rust already has established WebAssembly targets. It can compile low-level application logic to Wasm without introducing a tracing GC as part of Rust's memory model.

Goose's WebAssembly design note is explicitly a proposal, not an implemented target.

The difficulty is not just writing another compiler backend. Goose's data stacks depend on reserving large regions of address space so they can grow without moving. WebAssembly linear memory doesn't offer the same arrangement of independent reserved address ranges and guard gaps.

The proposal explores fixed partitions and relocatable stacks, with additional checks or different reference representations. That is a real engineering challenge created by the memory model itself.

Kotlin/Wasm takes another route with WasmGC. That is useful for Kotlin's goals but again falls outside mine.

So the language that looks simplest on a native 64-bit machine may have more work to do when the target has different memory primitives. Portability should be judged at the level of the memory model, not only the generated instruction set.

Is there something even closer to the ideal?

I also looked at languages trying to avoid both GC and Rust-style borrowing.

Vale explored memory safety through generational references, without a tracing collector or a borrow checker. But generational checks introduce a different kind of runtime work, and Vale is now archived. Its successor, Valen, is exploring another design.

Other languages simplify ownership by leaning on reference counting. That may be a perfectly reasonable trade for many applications, but it doesn't meet the particular constraint I started with.

I haven't found a verified language that gives me all of Goose's no-heap, no-GC, no-reference-counting, stable-growth benefits while also offering unrestricted object lifetimes and the full flexibility of a general-purpose systems language.

That doesn't prove such a language is impossible. It suggests that the restrictions are part of the price of the approach, not an accidental oversight.

So what would I choose?

If I were choosing one language to ship a broad range of native, mobile, backend, and WebAssembly software, I would choose Rust. Even ignoring ecosystem maturity, its more general ownership model accommodates programs that Goose's model deliberately restricts. The available platform support makes that decision easier.

If I were choosing the memory-management design I most want to explore, it would be Goose. The combination is genuinely attractive: automatic allocation and reclamation, no tracing GC, no reference counting, no manual frees for ordinary language-owned values, stable references into growing storage, and static memory safety without Rust's borrow-checking rules.

Those statements aren't contradictory. One is a decision about a complete programming platform. The other is a decision about an idea worth pursuing.

What I take away from Goose is not that Rust got memory safety wrong. It's that Rust's ownership model is not the last possible answer.

I want a language that lets me spend less time thinking about how memory is reclaimed, without hiding a collector or a counter behind the scenes. Goose gets unusually close to that vision, and its restrictions are exactly what make the experiment interesting.

For now, Rust is the language I'd build with. Goose is the language I'd keep studying.

References