4 ms·
Actually he later goes on to say the garbage collector can clean other resources by using the finalise method. The problem is that it doesn't necessarily clean
by fancyfredbot 4y ago
Actually he later goes on to say the garbage collector can clean other resources by using the finalise method. The problem is that it doesn't necessarily clean them up at the right time. The garbage collector isn't triggered by having too many open file descriptors, it runs when you are low on memory. In theory it could look at other resources too, but for certain resources you don't want to wait at all.
- arcticbull 4y agoThere's also generally no guarantee that finalizers ever run, period.
- slaymaker1907 4y agoThat really depends a lot on the language. You could have a language which guarantees all finalizers are run so long as the process terminates normally (i.e. not by a power outage).