Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Memory question

 
Shane Roylance
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I have a member variable that is an array of objects. If I were to do something like this:

1- Will myObjects point to a new array the second time through the loop (am I changing the pointer)?
2- Will the old array that I orphaned be picked up by the garbage collector?
TIA
Shane
[ August 06, 2002: Message edited by: Shane Roylance ]
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Shane,
1- Will myObjects point to a new array the second time through the loop (am I changing the pointer)?

Yes.
2- Will the old array that I orphaned be picked up by the garbage collector?

Yes, eventually.
Michael Morris
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic