logoalt Hacker News

wavemodetoday at 2:40 PM2 repliesview on HN

I would say the exact opposite, actually - Zig is a language specifically suited for TigerBeetle's all-at-once approach to memory management, and the approach more commonly used in Rust (allocate wherever and whenever) is non-idiomatic in Zig.

> only works for very specific use cases.

It's not clear to me what you mean by this.


Replies

Xirdustoday at 3:33 PM

The funny thing is that Rust works perfectly fine with statically preallocated memory. It's not even against its idioms - most code will work with zero changes. In a way, the borrow checker is the perfect tool for this situation, since nothing owns any memory and everything is borrowed from the static allocation.

show 1 reply
Aurornistoday at 3:15 PM

> It's not clear to me what you mean by this.

TigerBeetle calculates all the memory it needs at startup. It allocates that much memory once. It does not allocate memory dynamically.

This only works for very specific use cases, like a fixed server size where you know exactly how much memory you want to allocate to a process.

It’s not portable to general purpose computing, where it’s expected that apps aren’t allocating the maximum amount of memory they might use at startup. Their memory usage grows and shrinks as you open and close files or as your documents get longer.