"JavaRanch, where the deer and the Certified play" - David O'Meara
Originally posted by Matthew Son:
>> The JVM is allotted a certain amount of space by the OS.
The "certain amount of space" is what type of memory and how much is allotted?
>> Part of that is dedicated to the heap and part is reserved for JVM use.
What heap are you referring to - JVM's or OS's?
What is the part that is reserved for JVM use?
>> All objects live in the heap.
What does this mean? The object references or the objects themselves?
Does an object of a static class live in the heap?
e.g. Math math = new Math()
>> There is a stack for every "frame" in the JVM.
What is a frame?
Is it a memory type?
Is it in the JVM stack, JVM heap, or something else altogether?
>> Each Method gets it's own Frame.
Does a method of a class get a frame or a method of an object get a frame?
Does one class with 20 methods get 20 frames?
If there are 2 objects of that class, are there 20, 40, or 60 frames?
what is the implication of static here?
>> When the Method is over the stack is discarded.
How can a method of a class be over?
>> Local variables hold references in the stack for the method.
local variables = object references?
>> When the method is over and the stack discarded those are gone.
How is the stack discarded?
Are you referring to the JVM stack or the OS stack?
>> Instance variables (Fields) hold references that are kept in the object >> space in the heap.
are both the value and reference to the value in the heap?
how are primitive instance variables treated versus object instance variables.
>> Class declarations (Classfiles) go into a reserved area, which the ?
>> vendor can either implement in the heap or in the JVM reserved area
>> (which is more common).
so the class declarations are kept on disk?
can you describe the reserved area and how it maps to the OS memory?
>> All method declarations are kept in the Method area related to the
>> Classfile. (Once per class, not once per object)
the method declarations are read from the classfile? The speed with which objects can be created and methods can be executed hints that this cannot be the case.
That is one potential implementation of the specifications, yes.>> Static variables keep references in the reserved Classfile area.
Yep.>> Final variables can be optimized into constants by the JVM and are kept >> in the Constant Pool with the Classfile.
Can you draw me a picture of how all the OS components to memory and JVM components fit together?
"JavaRanch, where the deer and the Certified play" - David O'Meara
SCJP 1.4, SCWCD 1.3, SCBCD 1.3
>> Instance variables (Fields) hold references that are kept in the object >> space in the heap.
are both the value and reference to the value in the heap?
how are primitive instance variables treated versus object instance variables.
Not sure as all what you mean here. A variable that holds a primitive, holds that primitive. Some variables are in the stack, instance variables (fields) are in the object space, static variables are in the Classfile space, but still, no matter where the variable happens to be it holds the value of the primitive.
How are they treated?? Not sure what you mean � they are still just variables. It just saves the JVM one step because it has the value right there and does not have to follow a reference.
Don't get me started about those stupid light bulbs. |