3 ms·
Freeing up memory has a cost and if you don't need to do it then don't. And if you don't need to free up memory you can't have a memory leak.
by postalrat 3y ago
Freeing up memory has a cost and if you don't need to do it then don't. And if you don't need to free up memory you can't have a memory leak.
- throwaway81523 3y agoIf you aren't short of memory, why write in a language designed around managing it? The alternative is garbage collection, not simply leaking it.
- postalrat 3y agoYou can write an application that never frees memory and isn't leaking memory.
- throwaway81523 3y agoFor some embedded applications, fixed memory regions work fine. For something like a compiler, not so much. Remember that you have to deal with chunks of data of unpredictable size. Even string literals might occupy megabytes. You could program your way around that, but most of the time these days, it's ok to burn memory (i.e. use GC) for the sake of development velocity.