Hi all. So something I've become curious about is which resources actually need to be released by your program before it exits? Obviously having the ability to release resources during your program's lifetime is crucial to prevent leaks, but what I've always been a bit unsure of is what kind of leaks can actually happen when your program exits?
So for example, managing the memory allocations and deallocations of your program during its lifetime is crucially important, but as I understanding it, any modern OS will clean up all the memory allocated to your program when it exits, so once your program has decided to close, it doesn't need to go through and free all those memory allocations one by one first, because the OS will handle it anyway, right? Assuming that's correct, my question is what, if any, resources actually do need to be released? Can the OS be relied upon to clean up file handles? Sockets? GPU resources? Any insights anyone has on how OSs go about reclaiming resources and where there are potential gotchas here would be really interesting for me. Thanks!