Sponsored Link •
|
Advertisement
|
Advertisement
|
This page contains an archived post to the Design Forum (formerly called the Flexible Java Forum) made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.
Message:
The trick to release non-memory resources in a destructor in C++ seems not to apply anymore in Java, because garbage collection and finalization is not as controlled. Do you agree? Of course, may be it has never been an excellent idea in C++ to do so, but it is cleaner because C++ does not have a finally clause. Given this, we almost always have to provide a seperate method to release resources, and make sure that the method is called at the right time instead of relying on the finalizer to do so. It also seems that we almost always want to call System.runFinalizersOnExit(true) such that objects will be guaranteed to be finalized no matter how the program ends. Am I right?
Replies: |
Sponsored Links
|