• Post Reply Bookmark Topic Watch Topic
  • New Topic

garbage collection  RSS feed

 
charishma gottumukkula
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If an object is garbage collected can we retain it back or create a new object
 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can create a new object at any point of time. But once an object is garbage collected it cannot be reclaimed. It is not even available in memory anymore.
 
Anupam Sinha
Ranch Hand
Posts: 1090
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can create a similar object by persisting the Object's state but not have the same object back.
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We can't tell when something is actually collected, so it's as gone as it's going to get as soon as it's eligible for garbage collection. Is that a useful nit-pick?
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Stan James:
...it's as gone as it's going to get as soon as it's eligible for garbage collection. Is that a useful nit-pick?

Since we're nit-picking, I'll point out that "it is possible and completely legal in Java to resurrect objects in finalizers -- to bring them back to life by making them referenced again." (Ref. JavaWorld - Object finalization and cleanup, under the heading Avoid finalizer abuse.)
[ March 04, 2007: Message edited by: marc weber ]
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!