2 ms·
There are some old-hand approaches to this which work out fine. An example would be a generous rolling buffer, with enough room for the data you're working on.
by samatman 4y ago
There are some old-hand approaches to this which work out fine.
An example would be a generous rolling buffer, with enough room for the data you're working on. Most tools which are working on a stream of data don't require much memory, they're either doing a peephole transformation or building up data with filtration and aggregation, or some combination.
You can't have a use-after-free bug if you never call free, treating the OS as your garbage collector for memory (not other resources please) is fine.
- woodruffw 4y agoYeah, those are the approaches that I've used (back when I wrote more user tools in C). I wonder how those techniques translate to a language like Zig, where I'd expect the naive approach to be to allocate a new string for each line/datum (which would then never truly be freed, under this model.)