File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Memory question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Memory question" Watch "Memory question" New topic
Author

Memory question

Shane Roylance
Ranch Hand

Joined: Aug 29, 2001
Posts: 72
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

Joined: Jan 30, 2002
Posts: 3451
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


Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Memory question