|
|
|
|
|
by foldr
280 days ago
|
|
>I'd rather have my resource management verified at compile time and with no runtime overhead Malloc and free have runtime overhead — sometimes more than the overhead of garbage collection. The only way to have no overhead is to statically allocate fixed sized buffers for everything. |
|
If I'm reading a file, then opening and closing a file is not overhead either. But if I'm reading a file and some convoluted system in my own process is slapping some 3000% extra work on top because it needs to asynchronously track opened files and close them at arbitrary time later - that is overhead and creates bugs.
Which is one reason why many GC languages end up with bad emulations of an almost overhead free pattern like "try-with-resources" in Java and "IDisposable" in C# etc.