SCJP 1.6, SCWCD 5.0, SCBCD 5.0 [loading..]
SCJP 1.6, SCWCD 5.0, SCBCD 5.0 [loading..]
SCJA
~Currently preparing for SCJP6
-kolli
SCJP 1.6, SCWCD 5.0, SCBCD 5.0 [loading..]
Bill Shirley - bshirley - frazerbilt.com
if (Posts < 30) you.read( JavaRanchFAQ);
SCJP 1.6, SCWCD 5.0, SCBCD 5.0 [loading..]
"Computer science is no more about computers than astronomy is about telescopes" - Edsger Dijkstra
Originally posted by Mike Simmons:
"objects are always allocated on the heap" is wrong, nowadays
SCJP 1.6, SCWCD 5.0, SCBCD 5.0 [loading..]
Originally posted by Himalay Majumdar:
looks like Campbell wants me to keep my mouth shut on this topic![]()
Thanks all
Originally posted by Himalay Majumdar:
Instance variable 'height' and 'str' along with the class variable 'var' live inside the object they belong to and hence are in the heap.
SCJP 1.6, SCWCD 5.0, SCBCD 5.0 [loading..]
So was I.Originally posted by Himalay Majumdar:
Thanks for pointing on that, I was hoping someone would tell me about it.
If it is local to a method, the reference will live on the stack. If it is a member of an object it has to be on the heap.
Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
Originally posted by Mike Simmons:
you simply don't need to know whether data are stored on the stack or heap or behind the sofa. It doesn't matter. (Most of the time.)
Since the original poster is one of the main ones here who seems to want to dig into the details, perhaps it would be appropriate to move this thread out of Beginner
SCJP 1.6, SCWCD 5.0, SCBCD 5.0 [loading..]
SCJP 1.6, SCWCD 5.0, SCBCD 5.0 [loading..]
Originally posted by Henry Wong:
To add to the mess, with some of the Java 6 and later optimizations, it may not be possible to tell where the object is -- With "escape analysis", the JVM may decide to place certain objects on the stack.
This whole topic is nice and all, but may be moot for future releases of the JVM.
Henry
Cheers, Martijn,
Twitter.
Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
SCJP 1.6, SCWCD 5.0, SCBCD 5.0 [loading..]
Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
"Computer science is no more about computers than astronomy is about telescopes" - Edsger Dijkstra
Originally posted by Campbell Ritchie:
Not sure, but I think objects only go onto the stack when it is clear to the JVM that they are only required briefly, which I think means local variables.
Anybody else?
I claim this furniture in the name of The Ottoman Empire! You can keep this tiny ad:
Master Gardener Program
https://coderanch.com/t/771761/Master-Gardener-Program
|