简体   繁体   中英

Is the Java .class file stored in JVM memory

I read on the JVM memory model and got confused with the follows:

  1. Does the JVM store the .class instance in its memory. If yes then in which area.
  2. 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.
  3. The perm gen etc areas store the byte code or the machine level code?
  4. perm gen vs method area

I would really appreciate any help on the topic.

Thanks.

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.

Does the JVM store the .class instance in its memory.If yes then in which area

PermGen

Is it like as soon as the class is loaded

You can load the class without reading the .class

,the JVM generated machine level code and then starts executing the machine code instructions

The byte code is interpreted or potentially compiled to native machine code some time later.

The perm gen etc areas store the byte code or the machine level code?

Both. They are inseparable.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM