Skip to main content

Timeline for Multiple Same Object Instantiation

Current License: CC BY-SA 3.0

8 events
when toggle format what by license comment
Jan 3, 2017 at 19:25 comment added Doc Brown @Doval: I agree, this comment is pedantic ;-)
Jan 3, 2017 at 19:04 comment added Doval if between step 2 and step 3 the reference to the first instantiation is stored somewhere else (like Test test2 = test;), and that variable is still in scope when step 3 occurs... This is somewhat pedantic but garbage collection isn't based on scope, but on reachability. It's possible that a variable is in scope, but its value is no longer used, and that value can be garbage collected. Garbage collectors don't have scopes handy to make decisions based on that.
Aug 14, 2012 at 9:57 comment added Doc Brown @MichaelBorgwardt: changed my answer due to your comment.
Aug 14, 2012 at 9:57 history edited Doc Brown CC BY-SA 3.0
changed due to comment
Aug 14, 2012 at 9:20 comment added Michael Borgwardt The JVM does not do reference counting. Strictly speaking, the spec does not mandate how (or even that) garbage collection is implemented, but all mainstream JVMs use some sort of tracing collector.
Aug 14, 2012 at 6:46 vote accept Lawrence Gimenez
Aug 14, 2012 at 6:12 history edited Doc Brown CC BY-SA 3.0
added 115 characters in body
Aug 14, 2012 at 6:03 history answered Doc Brown CC BY-SA 3.0