I read on the JVM memory model and got confused with the follows:
- Does the JVM store the .class instance in its memory. If yes then in which area.
- Is it like as soon as the class is loaded,the JVM generated machine level code and then starts executing the machine code instructions and then only the objects are created on heap and method area is populated.
- The perm gen etc areas store the byte code or the machine level code?
- perm gen vs method area
I would really appreciate any help on the topic.
Thanks.
PermGen
You can load the class without reading the
.class
The byte code is interpreted or potentially compiled to native machine code some time later.
Both. They are inseparable.
1)
.class
file will be store in permgen memory area on load.2) Objects on HEAP will be created while program run, when you explicitly create, not on load. The JVM compiles methods 'lazily', that is it emits small stubs in place of the compiled machine code of the method that will trigger the compilation of each method. This means that methods that are not used are never compiled.
3) perm gen stores bytes code (.class file will be loaded), not sure about machine level code.