2 ms·
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 does
by _flux 4y ago
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..
- SpaghettiCthulu 4y agoArena allocators are pretty common for that.