2 ms·
Can you elaborate on the unusual part?
by Yokohiii 2mo ago
Can you elaborate on the unusual part?
- WD-42 2mo agoAll necessary memory is allocated at initialization. The application is not allowed any allocations during it's normal runtime. This is how it avoid memory bugs. Not a lot of people write programs this way.
- ahoka 2mo agoA lot of people write software like this when predictable latency is a hard requirement.
- leonidasrup 2mo agoAndrew Kelleys original motivation for creating Zig was language that allowed precise low-level control for real-time audio processing. "Kelley describes why he created Zig, when other options including C, C++, Rust, and Go already exist. He said he set out to develop a digital audio workstation. He tried Go, but found interoperability with C libraries difficult, and said the garbage collector caused audio delays. He tried C++, or coding C-style using a C++ compiler, but found that small mistakes led to memory corruption bugs that took weeks to fix. He tried Rust but "really struggled to write code that would satisfy Rust's rules," and spent a month trying to make font rendering work." https://www.theregister.com/software/2026/05/28/zig-creator-seeks-uncompromising-perfection-before-blessing-10/5247916 https://www.theregister.com/software/2026/05/28/zig-creator-...
- pton_xd 2mo agoThis is standard practice in the games industry.
- deleted 2mo ago[deleted]
- NothingAboutAny 2mo agoI do this in Unity because allocations/GC cause hitches. it's pretty normal thing to do there's even the built in pooling libraries so you can pre-allocate 10,000 gameobjects when the game starts. I haven't played with ECS/DOTS yet but I assume it does something similar.
- n6242 2mo agoI was just learning yesterday that's exactly what GTA did on PS2, which I thought was interesting. (Not to belittle your point, just giving an example)
- adamrezich 2mo agoThis is how basically every console video game works.
- physicsguy 2mo agoStatic memory allocation is widely used in quite a bit of embedded software, particularly safety critical stuff. There it's often latency related since you don't want hangs while memory is allocated. I've even seen it on some simulation software's core that was written in the 80s originally; at the time memory was much more constrained so allocating upfront meant you could check upfront whether the simulation could actually run or not vs crashing out part way through.
- z0ltan 2mo ago[dead]
- tovej 2mo agoI do. The only thing I need dynamic allocations for is queues of asynchronous events, and that's just because I'm too lazy to calculate an upper bound for how many there may be.
- KingMob 2mo agoA number of commenters have pointed out static allocation, but none mentioned TigerBeetle's sophisticated testing suite, which is more relevant. See here for a post on their deterministic simulation harness: https://tigerbeetle.com/blog/2023-07-06-simulation-testing-for-liveness/ https://tigerbeetle.com/blog/2023-07-06-simulation-testing-f...