“共享对象内存”与“堆内存”对比- 爪哇

发布于 2024-11-27 05:48:28 字数 106 浏览 1 评论 0原文

Java 中的“共享对象内存”和“堆内存”有什么区别。 “共享对象内存”是“堆内存”的超集吗?

这个问题的来源是jmap的文档。它提供了不同的选项来打印“共享对象内存”和“堆内存”。

What is difference between 'Shared Object Memory' and 'Heap Memory' in Java. Is it like 'Shared Object Memory' is superset of 'Heap Memory'?

The source of this question is documentation of jmap. It provides different options to Print 'Shared Object Memory' and 'Heap Memory'.

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

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

发布评论

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

评论(3

七秒鱼° 2024-12-04 05:48:28

Java 内存(最高 Java 8)由 3 部分组成:

  1. 堆内存。
  2. 非堆内存(PermGen)。
  3. 其他内存(JVM 自己的结构)。

所有类实例的内存都是从堆中分配的。
非堆内存主要由类加载器用来存储与类相关的数据。

有关共享对象的一些详细信息如下:什么是共享对象文件?

Java memory (up to Java 8) consists of 3 parts:

  1. Heap memory.
  2. Non-heap memory (PermGen).
  3. Other memory (JVM own structures).

Memory for all class instances is allocated from the heap.
Non-heap memory is primarily used by ClassLoaders to store class-related data.

Some details about shared objects are here: what is shared objects file?.

旧时浪漫 2024-12-04 05:48:28

从我到目前为止的分析来看:

默认选项将打印所有内存信息,包括:

  • 堆内存
  • 永久代
  • 其他内存(包括JNI,堆栈空间等)

此分析基于以下内容:

在JDK文档中提到默认值options(即“共享对象内存”)类似于 Solaris 的 pmap 命令。查看 pmap 命令,它似乎打印了完整的内存信息。

请添加评论以验证这一理解。

From my analysis so far:

The default option would print all the memory information including:

  • Heap Memory
  • Perm Gen
  • Other Memory (including JNI, Stack space, etc)

This analysis if on the basis of followings:

In JDK docs it is mentioned that the default options (which is 'Shared Object Memory') is similar to pmap command of Solaris. Looking at pmap command, it seems it prints the complete memory information.

Please add comments to validate this understanding.

合约呢 2024-12-04 05:48:28

共享对象内存是对 java 库中经常访问的类进行内存映射的地方,这样它们的加载速度比从 rt.jar 加载速度更快。这包括许多常用的类,例如ComparableStringObject等。如果请求的类文件在共享对象内存中不可用,则它是从 rt.jar 请求。可以认为是缓存各种java程序中经常使用的类。

Shared object memory is where frequently accessed classes of java library are memory mapped so that they can be loaded faster than loading from rt.jar. This includes many commonly used classes like Comparable, String, Object etc. If a requested class file is not available in shared object memory, it is requested from rt.jar. It can be thought of as caching frequently used classes in various java programs.

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