Java .class文件是否存储在JVM内存中 [英] Is the Java .class file stored in JVM memory

查看:527
本文介绍了Java .class文件是否存储在JVM内存中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我阅读了JVM内存模型,并对以下内容感到困惑:

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

  1. JVM是否将.class实例存储在其内存中.如果是,那么在哪个区域.
  2. 就像加载了类一样,JVM生成了吗? 机器级别的代码,然后开始执行机器代码 指令,然后仅在堆上创建对象并 方法区域已填充.
  3. perm gen等区域存储字节码或机器级别 代码?
  4. 烫发产生与方法范围
  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.

谢谢.

推荐答案

1).class文件将在加载时存储在permgen内存区域中.

1) .class file will be store in permgen memory area on load.

2)HEAP上的对象将在程序运行时在显式创建时(而不是在加载时)创建. JVM懒惰地"编译方法,也就是说,它发出小的存根代替将触发每个方法编译的方法的已编译机器代码.这意味着永远不会编译不使用的方法.

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存储字节代码(将加载.class文件),不确定机器级别的代码.

3) perm gen stores bytes code (.class file will be loaded), not sure about machine level code.

这篇关于Java .class文件是否存储在JVM内存中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆