什么是烫发空间?

发布于 2024-08-02 03:11:52 字数 69 浏览 2 评论 0原文

在学习 Java 内存分析时,除了“堆”之外,我还不断看到术语“永久空间”。 我知道堆是什么 - 什么是 Perm 空间?

While learning about java memory profiling, I keep seeing the term "perm space" in addition to "heap." I know what the heap is - what's perm space?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(10

一百个冬季 2024-08-09 03:11:52

它代表永久代

永久代很特殊
因为它包含描述的元数据
用户类别(不是的类别
Java 语言的一部分)。 例子
这些元数据的一部分是对象
描述类和方法以及
它们被存储在永久
一代。 大型应用
代码库可以快速填满这个
堆的段,这将导致
java.lang.OutOfMemoryError:PermGen 否
不管你的-Xmx有多高以及多少
您机器上的内存。

It stands for permanent generation:

The permanent generation is special
because it holds meta-data describing
user classes (classes that are not
part of the Java language). Examples
of such meta-data are objects
describing classes and methods and
they are stored in the Permanent
Generation. Applications with large
code-base can quickly fill up this
segment of the heap which will cause
java.lang.OutOfMemoryError: PermGen no
matter how high your -Xmx and how much
memory you have on the machine.

北城挽邺 2024-08-09 03:11:52

Perm space 用于保存加载类的信息以及一些其他高级功能,例如String Pool(用于高度优化的字符串相等性测试),通常由 String 创建.intern() 方法。
随着您的应用程序(类数量)的增长,该空间将很快被填满,因为该空间上的垃圾收集对于按要求进行清理并不有效,您很快就会出现“内存不足:永久生成空间”错误。 此后,即使有一个巨大的空 JVM,任何应用程序都无法在该机器上有效运行。

在启动应用程序之前,您应该使用 java -XX:MaxPermSize 来消除此错误。

Perm space is used to keep informations for loaded classes and few other advanced features like String Pool(for highly optimized string equality testing), which usually get created by String.intern() methods.
As your application(number of classes) will grow this space shall get filled quickly, since the garbage collection on this Space is not much effective to clean up as required, you quickly get Out of Memory : perm gen space error. After then, no application shall run on that machine effectively even after having a huge empty JVM.

Before starting your application you should java -XX:MaxPermSize to get rid of this error.

嘿哥们儿 2024-08-09 03:11:52

简单(而且过于简单)的答案:这是 jvm 存储自己的簿记数据的地方,而不是你的数据。

Simple (and oversimplified) answer: it's where the jvm stores its own bookkeeping data, as opposed to your data.

梨涡少年 2024-08-09 03:11:52

Perm Gen 代表永久生成,它保存有关类的元数据信息。

  1. 假设如果您创建一个类名 A,它的实例变量将存储在堆内存中,并且类 A 和静态类加载器将存储在永久代中。
  2. 垃圾收集器会发现很难清除或释放永久代内存中存储的内存空间。 因此,始终建议将 permgen 内存设置保持在建议的限制内。
  3. JAVA8引入了元空间生成的概念,因此当您使用jdk 1.8版本时,不再需要permgen。

Perm Gen stands for permanent generation which holds the meta-data information about the classes.

  1. Suppose if you create a class name A, it's instance variable will be stored in heap memory and class A along with static classloaders will be stored in permanent generation.
  2. Garbage collectors will find it difficult to clear or free the memory space stored in permanent generation memory. Hence it is always recommended to keep the permgen memory settings to the advisable limit.
  3. JAVA8 has introduced the concept called meta-space generation, hence permgen is no longer needed when you use jdk 1.8 versions.
_蜘蛛 2024-08-09 03:11:52

永久代空间是堆中保存虚拟机本身所有反射数据的区域,例如类和方法对象。

The permgen space is the area of heap that holds all the reflective data of the virtual machine itself, such as class and method objects.

ˇ宁静的妩媚 2024-08-09 03:11:52

它包含类定义、字符串池等内容。我想你可以称之为元数据。

It holds stuff like class definitions, string pool, etc. I guess you could call it meta-data.

世界等同你 2024-08-09 03:11:52

PermGen 空间通常被称为方法区。当类加载器子系统将类文件(字节代码)加载到方法区(permGen)时。
它包含所有类元数据,例如:类的完全限定名称、直接父类的完全限定名称、变量信息、构造函数信息、常量池信息等。

Permgen space is always known as method area.When the classloader subsystem will load the the class file(byte code) to the method area(permGen).
It contains all the class metadata eg: Fully qualified name of your class, Fully qualified name of the immediate parent class, variable info, constructor info, constant pool infor etc.

追风人 2024-08-09 03:11:52

PremGen 下存在什么:类区域属于 PremGen 区域。 静态字段也是在类加载时开发的,因此它们也存在于 PremGen 中。 常量池区域保存了所有像字符串一样池化的不可变字段。 除此之外,还定位了类加载器加载的类数据、对象数组、jvm 使用的内部对象。

What exists under PremGen : Class Area comes under PremGen area. Static fields are also developed at class loading time, so they also exist in PremGen. Constant Pool area having all immutable fields that are pooled like String are kept here. In addition to that, class data loaded by class loaders, Object arrays, internal objects used by jvm are also located.

对你的占有欲 2024-08-09 03:11:52

PermGen Space 代表永久生成的内存分配 所有 Java 不可变对象都属于此类别,例如使用文字或使用 String.intern() 方法创建并用于加载的 String将课程放入内存中。 PermGen Space 加速了我们的字符串相等性搜索。

PermGen Space stands for memory allocation for Permanent generation All Java immutable objects come under this category, like String which is created with literals or with String.intern() methods and for loading the classes into memory. PermGen Space speeds up our String equality searching.

比忠 2024-08-09 03:11:52
  • JVM 具有 Java 对象的内部表示以及那些内部表示
    存储在堆中(年轻代或终身代)。
  • JVM 还具有 Java 类的内部表示以及那些
    存储在永久生成

在此处输入图像描述

  • JVM has an internal representation of Java objects and those internal representations
    are stored in the heap (in the young generation or the tenured generation).
  • JVM also has an internal representation of the Java classes and those
    are stored in the permanent generation

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文