| Author |
primitives and garbage collection
|
anagha patankar
Ranch Hand
Joined: Dec 26, 2005
Posts: 53
|
|
as I understand primitives and object references are stored on the stack while the actual objects are stored on the garbage collectible heap . Question being - so does this mean that the primitives on stack are never removed - are they ever garbage collected ?. Regards, -anagha
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24040
|
|
|
That's right. Primitives on the stack are not garbage collected. But as soon as a method returns, the stack it used is eligible to be re-used -- the stack memory is simply overwritten. That's how a program stack works.
|
[Jess in Action][AskingGoodQuestions]
|
 |
 |
|
|
subject: primitives and garbage collection
|
|
|