java内存池是如何划分的? [英] How is the java memory pool divided?

查看:843
本文介绍了java内存池是如何划分的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用jconsole监控Java应用程序。内存选项卡允许您选择:

I’m currently monitoring a Java application with jconsole. The memory tab lets you choose between:

Heap Memory Usage
Non-Heap Memory Usage
Memory Pool "Eden Space"
Memory Pool "Survivor Space"
Memory Pool "Tenured Gen"
Memory Pool "Code Cache"
Memory Pool "Perm Gen"

它们之间有什么区别?

What is the difference between them ?

推荐答案

堆内存



堆内存是运行时数据区Java VM从中为所有类实例和数组分配内存。堆可以是固定的或可变的大小。垃圾收集器是一个自动内存管理系统,可以回收对象的堆内存。

Heap memory

The heap memory is the runtime data area from which the Java VM allocates memory for all class instances and arrays. The heap may be of a fixed or variable size. The garbage collector is an automatic memory management system that reclaims heap memory for objects.


  • Eden Space :最初为大多数对象分配内存的池。

  • Eden Space: The pool from which memory is initially allocated for most objects.

幸存者空间:包含在伊甸园空间垃圾收集中幸存下来的对象的池。

Survivor Space: The pool containing objects that have survived the garbage collection of the Eden space.

Tenured Generation Old Gen :包含幸存者空间中已存在一段时间的对象的池。

Tenured Generation or Old Gen: The pool containing objects that have existed for some time in the survivor space.

非堆内存包括方法区域在Java VM的内部处理或优化所需的所有线程和内存之间共享。它存储每类结构,例如运行时常量池,字段和方法数据,以及方法和构造函数的代码。方法区域在逻辑上是堆的一部分,但是,根据实现,Java VM可能不会垃圾收集或压缩它。与堆存储器一样,方法区域可以是固定的或可变的大小。方法区域的内存不需要是连续的。

Non-heap memory includes a method area shared among all threads and memory required for the internal processing or optimization for the Java VM. It stores per-class structures such as a runtime constant pool, field and method data, and the code for methods and constructors. The method area is logically part of the heap but, depending on the implementation, a Java VM may not garbage collect or compact it. Like the heap memory, the method area may be of a fixed or variable size. The memory for the method area does not need to be contiguous.


  • 永久生成:池包含虚拟机本身的所有反射数据,例如类和方法对象。对于使用类数据共享的Java VM,这一代分为只读和读写区域。

  • Permanent Generation: The pool containing all the reflective data of the virtual machine itself, such as class and method objects. With Java VMs that use class data sharing, this generation is divided into read-only and read-write areas.

代码缓存 :HotSpot Java VM还包括一个代码缓存,其中包含用于编译和存储本机代码的内存。

Code Cache: The HotSpot Java VM also includes a code cache, containing memory that is used for compilation and storage of native code.

以下是有关如何使用Jconsole的一些文档

这篇关于java内存池是如何划分的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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