Java 8中的Java内存区域 [英] Java memory areas in java 8

查看:249
本文介绍了Java 8中的Java内存区域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经阅读了很多有关Java内存区域的信息,但是看起来只是一团糟.主要是由于在Java8中引入了新的MetaSpace区域而不是PermGen.现在有问题:

I have read a lot about java memory areas, but looks like it is just a mess. Mostly due to the introduction of a new MetaSpace area instead of PermGen in java8. And there are questions now:

  1. heap在java8 +中包括哪些区域?
  2. static方法和变量存储在java8和java8 +之前的位置吗?
  3. MetaSpace是否存储除类元数据信息以外的任何内容?
  4. 存储区的结构是否取决于JVM的实现?
  1. What areas does the heap include in java8+ ?
  2. Where the static methods and variables are stored before java8 and java8+ ?
  3. Does the MetaSpace store anything except class meta-data info ?
  4. Does the structure of memory areas depend on the implementation of JVM ?

谢谢您的回答.

推荐答案

  1. 内存区域的结构是否取决于JVM的实现?

绝对. PermGen或Metaspace只是特定JVM的实现细节.以下答案是关于HotSpot JVM(Java SE虚拟机的参考实现)的.

Absolutely. PermGen or Metaspace are just implementation details of a particular JVM. The following answers are about HotSpot JVM, the reference implementation of Java SE virtual machine.

  1. 堆在java8 +中包括哪些区域?

由于上述原因,用在JDK 8中"而不是在"Java 8中"来表达更为正确.

For the above reason it would be more correct to say "in JDK 8" rather than "in Java 8".

Java Heap的结构取决于所选的GC算法.例如.使用并行GC和CMS时,堆分为老一代和年轻一代,后者由伊甸园和两个幸存者空间组成.

The structure of Java Heap depends on the selected GC algorithm. E.g. with Parallel GC and CMS the heap is divided into Old and Young generations, where the latter consists of Eden and two Survivor Spaces.

G1堆分为相同大小的区域. Epsilon GC堆是单个整体区域.依此类推.

G1 Heap is divided into the regions of the same size. Epsilon GC heap is a single monolithic area. And so on.

  1. 将静态方法和变量存储在java8和java8 +之前的位置吗?

方法(静态和非静态)都驻留在JDK 8中的Metaspace或JDK 8之前的PermGen中. ,偏移量)在Metaspace中.

Methods (both static and non-static) reside in Metaspace in JDK 8 or in PermGen prior to JDK 8. Not sure what you mean by "variables": field values are in Java Heap, the field metadata (names, types, offsets) is in Metaspace.

  1. MetaSpace是否存储除类元数据信息以外的任何内容?

以下各项存储在元空间中:

The following items are stored in Metaspace:

  • 类(它们的内部表示形式)
  • 符号(名称和签名)
  • 原始数组(例如,字段元数据表示为无符号短裤的数组)
  • 方法及其字节码
  • 方法计数器
  • 恒定池和CP缓存
  • 注释

所有这些都可以视为类元数据".

All of these can be considered "class metadata".

这篇关于Java 8中的Java内存区域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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