|
|
|
|
|
by codeflo
1481 days ago
|
|
To be technically correct, it’s called a finalizer in that case to distinguish it from deterministic destructors. For resources like memory, where it’s merely a question of performance, I would agree. But some resources have correctness implications. Files, for example, you often want to close deterministically. It’s simply a terrible experience if a user can’t save because a file handle from a previous operation still lingers in a GC queue somewhere. That’s also the reason why language features like try-with-resources were added in the first place. |
|