withFile defeats dead handle closure
Sven Panne
svenpanne at gmail.com
Thu Dec 31 10:26:09 UTC 2020
Am Mi., 30. Dez. 2020 um 22:47 Uhr schrieb Viktor Dukhovni <
ietf-dane at dukhovni.org>:
> [...] It would amount to relying on GC to close the handle perhaps a bit
> earlier, and my take is that any such reliance is a bug.[...]
+1
As a general rule of thumb: Automatic memory management is good for, well,
memory management, but nothing else. Quite the opposite: Most of the time
it's horrible for other tasks. There are tons of points in the design space
of automatic memory management with vastly different trade-offs regarding
throughput, latency, concurrency etc., so tying other "heavy" resources
like file descriptors to automatic memory management is a very, very bad
idea. People had cunning ideas about how to (ab-)use finalizers etc. for
decades, but basically all of them turned out to be bad. Hans-J. Boehm has
written extensively about this, and his papers are still worth reading
today.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20201231/fca9c89d/attachment.html>
More information about the Libraries
mailing list