方法区和 PermGen
我试图了解 HotSpot JVM 的内存结构,但对 方法区" 和 PermGen" 空间这两个术语感到困惑.我提到的文档说方法区包含类和方法的定义,包括字节码.其他一些文档说它们存储在 PermGen 空间中.
I was trying to understand the memory structure of HotSpot JVM and got confused with the two terms "Method Area" and "PermGen" space. The docs I referred to say that Method Area contains the definition of classes and methods including the byte code. Some other docs say that they are stored in the PermGen space.
那么我可以断定这两个内存区域相同吗?
So can I conclude that these two memory areas are same?
推荐答案
你应该看看 Java 内存类型 以及关于 垃圾收集.后者非常冗长,两者都很有用.
You should take a look at Java Memory Types and optionally at this doc about the Garbage Collection in Java. The latter is very verbose and both are useful.
其实Method区域是Permanent Generation的一部分:
Actually the Method area is a part of the Permanent Generation:
与终身代密切相关的第三代是永久一代.永久代是特殊的,因为它保存虚拟机需要的数据来描述对象在 Java 语言级别上没有等价物.例如描述类和方法的对象存储在永久一代.
A third generation closely related to the tenured generation is the permanent generation. The permanent generation is special because it holds data needed by the virtual machine to describe objects that do not have an equivalence at the Java language level. For example objects describing classes and methods are stored in the permanent generation.
相关文章