Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Garbage Collection

 
Baskar Dilli
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when the objects are declared with static modfier, will it be garbage collected? when there is no reference from active stack frame.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64712
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"baskar d", please check your private messages for an important administrative matter.
 
Peter Chase
Ranch Hand
Posts: 1970
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by baskar d:
when the objects are declared with static modfier, will it be garbage collected? when there is no reference from active stack frame.


Objects cannot be static or non-static. Object references are static or non-static.

An object will be garbage collected some time after the last reference to it has gone away. It doesn't matter whether those references are static or non-static.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic