Java Object: Difference between revisions

From GM-RKB
Jump to navigation Jump to search
m (Text replacement - ". ----" to ". ----")
m (Text replacement - ". " to ". ")
Line 15: Line 15:
=== 1996 ===
=== 1996 ===
* http://www.javaworld.com/javaworld/jw-08-1996/jw-08-gc.html
* http://www.javaworld.com/javaworld/jw-08-1996/jw-08-gc.html
** The [[JVM's heap]] stores all [[Java Object|object]]s created by an [[executing Java program]]. [[Java Object|Object]]s are created by [[Java]]'s [["new" operator]], and memory for new [[Java Object|object]]s is allocated on the [[heap]] at [[Program Run Time|run time]]. [[Garbage collection]] is the process of automatically freeing [[OO Object|object]]s that are no longer referenced by the [[Executing Program|program]]. This frees the [[programmer]] from having to keep track of when to [[free allocated memory]], thereby preventing many potential bugs and headaches. The name “[[garbage collection]]” implies that [[object]]s that are no longer needed by the [[program]] are "garbage" and can be thrown away. A more accurate and up-to-date metaphor might be “[[memory recycling]]." When an [[OO Object|object]] is no longer referenced by the [[program]], the [[heap space]] it occupies must be recycled so that the space is available for subsequent new [[OO Object|object]]s. The [[garbage collector]] must somehow determine which [[OO Object|object]]s are no longer referenced by the program and make available the [[heap space]] occupied by such [[unreferenced object]]s. In the process of [[freeing]] [[unreferenced object]]s, the [[garbage collector]] must run any finalizers of [[OO Object|object]]s being freed.  
** The [[JVM's heap]] stores all [[Java Object|object]]s created by an [[executing Java program]]. [[Java Object|Object]]s are created by [[Java]]'s [["new" operator]], and memory for new [[Java Object|object]]s is allocated on the [[heap]] at [[Program Run Time|run time]]. [[Garbage collection]] is the process of automatically freeing [[OO Object|object]]s that are no longer referenced by the [[Executing Program|program]]. This frees the [[programmer]] from having to keep track of when to [[free allocated memory]], thereby preventing many potential bugs and headaches. The name “[[garbage collection]]” implies that [[object]]s that are no longer needed by the [[program]] are "garbage" and can be thrown away. A more accurate and up-to-date metaphor might be “[[memory recycling]]." When an [[OO Object|object]] is no longer referenced by the [[program]], the [[heap space]] it occupies must be recycled so that the space is available for subsequent new [[OO Object|object]]s. The [[garbage collector]] must somehow determine which [[OO Object|object]]s are no longer referenced by the program and make available the [[heap space]] occupied by such [[unreferenced object]]s. In the process of [[freeing]] [[unreferenced object]]s, the [[garbage collector]] must run any finalizers of [[OO Object|object]]s being freed.


----
----

Revision as of 12:24, 2 August 2022

A Java Object is a Java Class instantiated as an OO object within a Java-based computer process



References

1996