Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

never allocating memory can be and should be simple.


What language actually makes it simple?


In Zig, we are writing a moderately complex application that calls mmap many times in the first few seconds and never thereafter. We can use every part of the stdlib and most libraries because we can pass in allocators backed by the memory we reserved at startup.


This is very commonly done in C++. My programs do a flurry of mmaps in the first second, then run for, sometimes, years without allocating again.


I was thinking about C and C++ and whilst they allow you to be very careful about allocations, they also give you every opportunity to get it wrong.


We need not act on the opportunity.

All that is actually needed is for it to be more work to get it wrong than to get it right.


Zig, definitely.




Consider applying for YC's Winter 2027 batch! Applications are open till November 2.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: