This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

GarbageCollection  RSS feed

 
G Nadeem
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
ur help plz...

is the object created at line 2 elligible for GC after line 4 executes.
 
Corey McGlone
Ranch Hand
Posts: 3271
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes. Remember, Strings are immutable objects. Therefore, performing a concatenation operation creates a brand new String. It does not reference the existing Strings that were used in the concatentation.
Therefore, the object is eligible for garbage collection after line 4.
I hope that helps,
Corey
 
G Nadeem
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thnx v much Corey...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!