|
ABSTRACT
We compare two different facilities for running cleanup actions for objects that are about to reach the end of their life.Destructors, such as we find in C++, are invoked synchronously when an object goes out of scope. They make it easier to implement cleanup actions for objects of well-known lifetime, especially in the presence of exceptions.Languages like Java[8], Modula-3[12], and C\#[6] provide a different kind of "finalization" facility: Cleanup methods may be run when the garbage collector discovers a heap object to be otherwise inaccessible. Unlike C++ destructors, such methods run in a separate thread at some much less well-defined time.Languages like Java[8], Modula-3[12], and C\#[6] provide a different kind of "finalization" facility: Cleanup methods may be run when the garbage collector discovers a heap object to be otherwise inaccessible. Unlike C++ destructors, such methods run in a separate thread at some much less well-defined time.We argue that these are fundamentally different, and potentially complementary, language facilities. We also try to resolve some common misunderstandings about finalization in the process. In particular: - The asynchronous nature of finalizers is not just an accident of implementation or a shortcoming of tracing collectors; it is necessary for correctness of client code, fundamentally affects how finalizers must be written, and how finalization facilities should be presented to the user.
- An object may legitimately be finalized while one of its methods are still running. This should and can be addressed by the language specification amd client code.
REFERENCES
Note: OCR errors may be found in this Reference List extracted from the full text article. ACM has opted to expose the complete List rather than only correct and linked references.
| |
1
|
|
| |
2
|
H.-J. Boehm. A garbage collector for C and C++. http://www.hpl.hp.com/personal/Hans_Boehm/gc/.
|
| |
3
|
|
| |
4
|
G. Colvin, B. Dawes, P. Dimov, and D. Adler. Boost smart pointer library. http://www.boost.org/libs/smart_ptr/.
|
 |
5
|
R. Kent Dybvig , Carl Bruggeman , David Eby, Guardians in a generation-based garbage collector, Proceedings of the ACM SIGPLAN 1993 conference on Programming language design and implementation, p.207-216, June 21-25, 1993, Albuquerque, New Mexico, United States
|
| |
6
|
ECMA. Standard ECMA-334: C# Language Specification. ECMA, December 2001.
|
| |
7
|
J. R. Ellis and D. L. Detlefs. Safe, efficient garbage collection for C++. Technical Report CSL-93-4, Xerox Palo Alto Research Center, September 1993.
|
| |
8
|
|
| |
9
|
|
| |
10
|
J. Horning, B. Kalsow, P. McJones, and G. Nelson. Some useful modula-3 interfaces. Technical Report 113, Digital Systems Research Center, December 1993.
|
| |
11
|
IEEE and The Open Group. IEEE Standard 1003.1-2001. IEEE, 2001.
|
| |
12
|
|
| |
13
|
P. Rovner. On adding garbage collection and runtime types to a strongly-typed, statically-checked, concurrent language. Technical Report CSL-84-7, Xerox Palo Alto Research Center, July 1985.
|
| |
14
|
|
| |
15
|
Sun Microsystems. Java 2 platform, standard edition, v 1.4.0 api specification. http://java.sun.com/j2se/1.4/docs/api/, 2002.
|
| |
16
|
G. van Rossum. Python reference manual. http://www.python.org/doc/current/ref/ref.html.
|
CITED BY 5
|
|
|
|
|
|
|
|
Isil Dillig , Thomas Dillig , Eran Yahav , Satish Chandra, The CLOSER: automating resource management in java, Proceedings of the 7th international symposium on Memory management, June 07-08, 2008, Tucson, AZ, USA
|
|
|
|
|
|
|
|