Hacker News new | past | comments | ask | show | jobs | submit login

> Using a file-handle after it's been closed can cause all sorts of issue

Is this possible in managed languages like Java? AFAIK you'll get an exception which is a bug and can cause issues, but its not a safety concern.




No, you can get an exception, but that can happen either way (the OS can close the file handler irrespective of what the process does), and is not a safety violation.

The only problem that can happen in managed languages is leaking of file handlers by not manually closing them, leaving it up to the GC, and opening handles faster than they are being closed — this can cause the OS to run out of handlers for the process, terminating it.

But this is not a big issue in practice in my experience, in Javac try-with-resources idiomatically solves this issue.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: