News for hackers. Stuff that matters.
Re:Chibicc – A Small C Compiler by _flux on Sunday November 13, 2022 @08:24AM (#33582804)
It can be quite painful to add them afterwards and while the program might now be shortlived, this might not hold true in the future. And just maybe if one doesn't want to deal with manual memory management, then pick a tool/language that doesn't require it?

Maybe a practical alternative to this—that would still reap the performance benefits—would be to have an allocator that postpones frees until certain time (or e.g. number of bytes allocated) has been passed since the start of the program, and after that point works like normal alloc/free.

Actually this is not far from how garbage collecting languages work..

Re:Chibicc – A Small C Compiler by SpaghettiCthulu on Monday November 14, 2022 @01:27AM (#33590784)
Arena allocators are pretty common for that.