3 ms·
Memory leaks may not be possible but resource leaks can be. Many languages have tried to attach "disposers" to garbage collection events. The more common term
by jerf 3y ago
Memory leaks may not be possible but resource leaks can be.
Many languages have tried to attach "disposers" to garbage collection events. The more common term in this case is "finalizer". As far as I know, no language has ever had a general-purpose, robust solution that works so well that it can just be used. Many have tried, and they all end up either deprecated, determined by the community to be a footgun, or backed down to some specialized use case (like picking up after file handles that are GC'd but the expected thing is still that normal user code closes them and this is explicitly pitched as an undesirable fallback, not the thing you should do).