30-12-2009, 10:29 PM | #1 |
Member
Join Date: Dec 2009
Posts: 76
Rep Power: 15 |
Explain garbage collection?
|
30-12-2009, 10:31 PM | #2 |
Member
Join Date: Dec 2009
Posts: 76
Rep Power: 15 |
What kind of thread is the Garbage collector thread?
It is a daemon thread. Can an object's finalize() method be invoked while it is reachable? An object's finalize() method cannot be invoked by the garbage collector while the object is still reachable. However, an object's finalize() method may be invoked by other objects. Does garbage collection guarantee that a program will not run out of memory? Garbage collection does not guarantee that a program will not run out of memory. It is possible for programs to use up memory resources faster than they are garbage collected. It is also possible for programs to create objects that are not subject to garbage collection. What is the purpose of finalization? The purpose of finalization is to give an unreachable object the opportunity to perform any cleanup, before the object gets garbage collected. For example, closing an opened database Connection. If an object is garbage collected, can it become reachable again? Once an object is garbage collected, It can no longer become reachable again. |
Bookmarks |
Tags |
garbage collection |
|
|