News for hackers. Stuff that matters.
Re:Ask HN: Why do langs with alleged “automatic memory manag... by frou_dh on Thursday July 18, 2019 @01:53PM (#20472292)
That's what the concept of "Finalizers" is for. They indicate that something should be done to an object just before the runtime garbage collects it.

https://en.wikipedia.org/wiki/Finalizer

Files specifically are a bit thorny because the OS generally places a limit on how many simultaneous open files a process can have, and you don't want to risk bumping in to that limit due to unpredictable garbage collection timing.

There are no comments on this comment yet.