Jrockit 内存管理官方介绍

12、JRockit实时垃圾回收与Java内存管理深度解析 本文深入解析了JRockit实时垃圾回收机制与Java内存管理的关键策略。内容涵盖JRockit Real Time的软实时方法、自适应内存管理的成功案例、垃圾收集性能的核心实现原理,以及Java中不同引用类型的用途和注意事项。此外,文章还讨论了JVM行为差异、常见误区、优化建议及与C++内存管理的区别,为开发者提供全面的内存管理优化指导。 阅读详情

Understanding Memory Management

Memory management is the process of allocating new objects and removing unused objects to make space for those new object allocations. This section presents some basic memory management concepts and explains the basics about object allocation and garbage collection in the Oracle JRockit JVM. The following topics are covered:

For information about how to use command line options to tune the memory management system, see Tuning the Memory Management System.

 


The Heap and the Nursery

Java objects reside in an area called the heap. The heap is created when the JVM starts up and may increase or decrease in size while the application runs. When the heap becomes full, garbage is collected. During the garbage collection objects that are no longer used are cleared, thus making space for new objects.

Note that the JVM uses more memory than just the heap. For example Java methods, thread stacks and native handles are allocated in memory separate from the heap, as well as JVM internal data structures.

The heap is sometimes divided into two areas (or generations) called the nursery (or young space) and the old space. The nursery is a part of the heap reserved for allocation of new objects. When the nursery becomes full, garbage is collected by running a special young collection, where all objects that have lived long enough in the nursery are promoted (moved) to the old space, thus freeing up the nursery for more object allocation. When the old space becomes full garbage is collected there, a process called an old collection.

The reasoning behind a nursery is that most objects are temporary and short lived. A young collection is designed to be swift at finding newly allocated objects that are still alive and moving them away from the nursery. Typically, a young collection frees a given amount of memory much faster than an old collection or a garbage collection of a single-generational heap (a heap without a nursery).

In R27.2.0 and later releases, a part of the nursery is reserved as a keep area. The keep area contains the most recently allocated objects in the nursery and is not garbage collected until the next young collection. This prevents objects from being promoted just because they were allocated right before a young collection started.

 


Object Allocation

During object allocation, the JRockit JVM distinguishes between small and large objects. The limit for when an object is considered large depends on the JVM version, the heap size, the garbage collection strategy and the platform used, but is usually somewhere between 2 and 128 kB. Please see the documentation for -XXtlaSize and -XXlargeObjectLimit for more information.

Small objects are allocated in thread local areas (TLAs). The thread local areas are free chunks reserved from the heap and given to a Java thread for exclusive use. The thread can then allocate objects in its TLA without synchronizing with other threads. When the TLA becomes full, the thread simply requests a new TLA. The TLAs are reserved from the nursery if such exists, otherwise they are reserved anywhere in the heap.

Large objects that don’t fit inside a TLA are allocated directly on the heap. When a nursery is used, the large objects are allocated directly in old space. Allocation of large objects requires more synchronization between the Java threads, although the JRockit JVM uses a system of caches of free chunks of different sizes to reduce the need for synchronization and improve the allocation speed.

 


Garbage Collection

Garbage collection is the process of freeing space in the heap or the nursery for allocation of new objects. This section describes the garbage collection in the JRockit JVM.

The Mark and Sweep Model

The JRockit JVM uses the mark and sweep garbage collection model for performing garbage collections of the whole heap. A mark and sweep garbage collection consists of two phases, the mark phase and the sweep phase.

During the mark phase all objects that are reachable from Java threads, native handles and other root sources are marked as alive, as well as the objects that are reachable from these objects and so forth. This process identifies and marks all objects that are still used, and the rest can be considered garbage.

During the sweep phase the heap is traversed to find the gaps between the live objects. These gaps are recorded in a free list and are made available for new object allocation.

The JRockit JVM uses two improved versions of the mark and sweep model. One is mostly concurrent mark and sweep and the other is parallel mark and sweep. You can also mix the two strategies, running for example mostly concurrent mark and parallel sweep.

Mostly Concurrent Mark and Sweep

The mostly concurrent mark and sweep strategy (often simply called concurrent garbage collection) allows the Java threads to continue running during large portions of the garbage collection. The threads must however be stopped a few times for synchronization.

The mostly concurrent mark phase is divided into four parts:

  • Initial marking, where the root set of live objects is identified. This is done while the Java threads are paused.
  • Concurrent marking, where the references from the root set are followed in order to find and mark the rest of the live objects in the heap. This is done while the Java threads are running.
  • Precleaning, where changes in the heap during the concurrent mark phase are identified and any additional live objects are found and marked. This is done while the Java threads are running.
  • Final marking, where changes during the precleaning phase are identified and any additional live objects are found and marked. This is done while the Java threads are paused.

The mostly concurrent sweep phase consists of four parts:

  • Sweeping of one half of the heap. This is done while the Java threads are running and are allowed to allocate objects in the part of the heap that isn’t currently being swept.
  • A short pause to switch halves.
  • Sweeping of the other half of the heap. This is done while the Java threads are running and are allowed to allocate objects in the part of the heap that was swept first.
  • A short pause for synchronization and recording statistics.
Parallel Mark and Sweep

The parallel mark and sweep strategy (also called the parallel garbage collector) uses all available CPUs in the system for performing the garbage collection as fast as possible. All Java threads are paused during the entire parallel garbage collection.

Generational Garbage Collection

The nursery, when it exists, is garbage collected with a special garbage collection called a young collection. A garbage collection strategy which uses a nursery is called a generational garbage collection strategy, or simply generational garbage collection.

The young collector used in the JRockit JVM identifies and promotes all live objects in the nursery that are outside the keep area to the old space. This work is done in parallel using all available CPUs. The Java threads are paused during the entire young collection.

Dynamic and Static Garbage Collection Modes

By default, the JRockit JVM uses a dynamic garbage collection mode that automatically selects a garbage collection strategy to use, aiming at optimizing the application throughput. You can also choose between two other dynamic garbage collection modes or select the garbage collection strategy statically. The following dynamic modes are available:

  • throughput, which optimizes the garbage collector for maximum application throughput. This is the default mode.
  • pausetime, which optimizes the garbage collector for short and even pause times.
  • deterministic, which optimizes the garbage collector for very short and deterministic pause times. This mode is only available as a part of Oracle JRockit Real Time.

The major static strategies are:

  • singlepar, which is a single-generational parallel garbage collector (same as parallel)
  • genpar, which is a two-generational parallel garbage collector
  • singlecon, which is a single-generational mostly concurrent garbage collector
  • gencon, which is a two-generational mostly concurrent garbage collector

For more information on how to select the best mode or strategy for your application, see Selecting and Tuning a Garbage Collector.

Compaction

Objects that are allocated next to each other will not necessarily become unreachable (“die”) at the same time. This means that the heap may become fragmented after a garbage collection, so that the free spaces in the heap are many but small, making allocation of large objects hard or even impossible. Free spaces that are smaller than the minimum thread local area (TLA) size can not be used at all, and the garbage collector discards them as dark matter until a future garbage collection frees enough space next to them to create a space large enough for a TLA.

To reduce fragmentation, the JRockit JVM compacts a part of the heap at every garbage collection (old collection). Compaction moves objects closer together and further down in the heap, thus creating larger free areas near the top of the heap. The size and position of the compaction area as well as the compaction method is selected by advanced heuristics, depending on the garbage collection mode used.

Compaction is performed at the beginning of or during the sweep phase and while all Java threads are paused.

For information on how to tune compaction, see Tuning the Compaction of Memory.

External and Internal Compaction

The JRockit JVM uses two compaction methods called external compaction and internal compaction. External compaction moves (evacuates) the objects within the compaction area to free positions outside the compaction area and as far down in the heap as possible. Internal compaction moves the objects within the compaction area as far down in the compaction area as possible, thus moving them closer together.

The JVM selects a compaction method depending on the current garbage collection mode and the position of the compaction area. External compaction is typically used near the top of the heap, while internal compaction is used near the bottom where the density of objects is higher.

Sliding Window Schemes

The position of the compaction area changes at each garbage collection, using one or two sliding windows to determine the next position. Each sliding window moves a notch up or down in the heap at each garbage collection, until it reaches the other end of the heap or meets a sliding window that moves in the opposite direction, and starts over again. Thus the whole heap is eventually traversed by compaction over and over again.

Compaction Area Sizing

The size of the compaction area depends on the garbage collection mode used. In throughput mode the compaction area size is static, while all other modes, including the static mode, adjust the compaction area size depending on the compaction area position, aiming at keeping the compaction times equal throughout the run. The compaction time depends on the number of objects moved and the number of references to these objects. Thus the compaction area will be smaller in parts of the heap where the object density is high or where the amount of references to the objects within the area is high. Typically the object density is higher near the bottom of the heap than at the top of the heap, except at the very top where the latest allocated objects are found. Thus the compaction areas are usually smaller near the bottom of the heap than in the top half of the heap.

 

 
10、自适应内存管理:JRockit JVM 的卓越实践 本文深入探讨了 JRockit JVM 在内存管理方面的多项优化技术。重点介绍了其垃圾回收机制,包括并发标记清除算法、双色标记策略、存活位集合以及卡表的应用。同时详细解析了新生代和老年代的回收流程,以及压缩操作的实现方式。此外,文章还涵盖了 JRockit 在不同架构下的内存优化策略,如线程本地分配、支持非连续堆以及压缩引用技术,展示了其在 32 位和 64 位系统中的灵活性和高效性。无论是在性能优化还是资源利用方面,JRockit 都体现了其作为商业 JVM 的卓越实践。 阅读详情

相关推荐

11、自适应内存管理:JRockit的内存优化策略

本文详细介绍了JRockit的自适应内存管理策略,包括压缩引用、缓存友好性优化、预取技术、数据放置策略、NUMA架构支持、大页面使用以及垃圾收集的实时性优化等内容。通过这些技术,JRockit能够在不同应用场景下实现高效的内存利用和性能优化。文章还总结了不同内存管理特性的优缺点,提供了操作要点和适用场景的策略建议,并展望了JRockit内存管理的未来发展趋势。

dog123的博客 75

Java GC(垃圾回收)

1.java中GC     即垃圾收集机制是指jvm用于释放那些不再使用的对象所占用的内存。java语言并不要求jvm有gc,也没有规定gc如何工作。不过常用的jvm都有gc,而且大多数gc都使用类似的算法管理内存和执行收集操作。     垃圾收集的目的在于清除不再使用的对象。gc通过确定对象是否被活动对象引用来确定是否收集该对象。gc首先要判断该对象是否是时候可以收集。两种常用的方法是引用计

厚积而薄发 4170

36、JRockit JVM内存管理与监控命令详解

本文详细介绍了JRockit JVM中的多个内存管理与监控命令,包括print_memusage用于查看内存使用和检测本地内存泄漏,print_object_summary用于按类分析堆内存使用情况,print_properties用于查看JVM属性,print_threads用于分析线程堆栈,print_utf8pool用于列出JVM中的UTF-8常量,以及print_vm_state用于输出JVM状态信息。这些命令有助于提高JRockit JVM的性能和稳定性,适用于内存泄漏检测、线程分析、属性查看等多

dog123的博客 153

多等 33 秒,救回只产出思考的 5 分钟回合:dsh-our-free-model 长思考截断自动恢复

dsh-our-free-model 是装进 dsh 的免费模型插件——无需登录、注册或填 API Key,就能调用 DeepSeek V4.1 Flash、Kimi K3 等前沿模型,完全免费、不限量。它 issue #12 实现的**长思考截断自动恢复**专门处理一种特定场景:深度思考模型只流出了思考、还没产出正文就被上游掐断时,插件把已收到的思考当作检查点,额外发起一次续写请求,把死在半路的

gitblog_01072的博客 628

使用JRockit检测和解决内存泄漏问题

通过安装和配置JRockit,运行应用程序,并使用JRockit Mission Control等工具进行分析,开发人员可以定位和修复潜在的内存泄漏问题。在Mission Control的内存分析工具中,您可以查看对象的引用链和对象的生命周期。您可以使用内存分析工具来查看应用程序的内存使用情况,并检查是否存在内存泄漏。现在,您可以运行您的Java应用程序,并让其在JRockit虚拟机上执行。通过使用JRockit进行内存泄漏检测,您可以发现这个问题并采取适当的措施来修复它。步骤五:定位和修复内存泄漏。

2301_79331421的博客 436

9、自适应内存管理:JRockit 垃圾回收机制深度解析

本文深入解析了 JRockit 的自适应内存管理技术,涵盖 Livemaps 的工作机制、安全点方法的演进、分代垃圾回收的实现及其优化策略,并探讨了吞吐量与低延迟之间的权衡。通过对比不同垃圾回收策略的优缺点,为开发者提供了在不同应用场景下选择合适策略的指导建议。

dog123的博客 54

JRockit 性能优化参数汇总

一.JRockit调优简介       JRockit是一个自适应的JVM,它能够自动调整自己去适应底层硬件,因此对它的调优主要集中在一些需要人工干预的参数上,比如说:需要划分多少RAM给JRockit使用等。JRockit有一组非标准的-X启动选项,我们可以用它来调节 JVM。JRockit有两组主要的子系统可以被优化--内存管理系统(包括垃圾回收)和线程系统。在内存管理子系统方面,有很多调优...

Ferrerooo 成长 353

JRockit 1.6:Oracle高性能Java虚拟机详解

JRockit JDK由多个核心组件组成,它们共同保证了Java应用在JRockit虚拟机上能够以高性能、高稳定性的状态运行。主要的组件包括JRockit JVM、JRockit Mission Control、以及JRockit Real Time。JRockit JVM负责执行Java字节码、提供内存管理、垃圾回收和实时性能优化。JRockit Mission Control提供了一个强大的监控与管理控制台,用于实时监控和分析Java应用程序。

weixin_28713083的博客 419

jrockit的dump操作简介

jrockit的dump命令很简单,如果不熟悉。 先使用命令: jrcmd help 得到相关的options。然后使用选项hprofdump,使用此参数需要注意,应该使用这样的命令形式: jrcmd hprofdump filename=/home/hadoop/test.hprof 如图: 需要带上filename这个参数,不然不知道生成文件存放路径(另外需要绝对路径),我

分布式应用与服务器架构专栏 4436

jrockit 手册

jrockit使用心得手把手叫你解决内存溢出

Oracle JRockit

Oracle JRockit JRockit 现在是免费的了,可免费用于开发以及内部产品使用,同时 Oracle 修改了其授权协议

JRockit的使用

一.JRockit调优简介 JRockit是一个自适应的JVM,它能够自动调整自己去适应底层硬件,因此对它的调优主要集中在一些需要人工干预的参数上,比如说:需要划分多少 RAM给JRockit使用等。JRockit有一组非标准的-X启动选项,我们可以用它来调节JVM。JRockit有两组主要的子系统可以被优化-- 内存管理系统(包括垃圾回收)和线程系统。在内存管理子系统方面,有很多调优的工作可以做

小鱼的最爱 2989

JRockit JAVA内存溢出检测的使用(CHM)

NULL 博文链接:https://stride.iteye.com/blog/723340

oracle JRockit 介绍

Oracle JRockit (原来的 Bea JRockit)系列产品是一个全面的Java运行时解决方案组合,包括了行业最快的标准Java解决方案。 大量的行业基准测试显示,基本JRockit JVM是世界上最快的JVM。JRockit面向延迟敏感型应用的解决方案JRockit Real Time提供以毫秒或微秒计的JVM响应时间,适合财务前端办公、军事指挥与控制和电信网络的需要。使用JRo

changyanmanman的专栏 2855

低成本主从机械臂系统构建:6D位姿数据采集与VLA模型训练实战

本文详细介绍了如何构建低成本主从机械臂系统,实现高精度6D位姿数据采集与VLA模型训练。通过300美元级别的硬件组合,系统达到±1mm位置精度和≤0.5°姿态误差,满足Vision-Language-Action模型的多模态训练需求。文章涵盖硬件选型、数据采集技巧、模型训练实战经验,为机器人研究提供经济高效的解决方案。

r7s8t的博客 266

高效穿搭博主内容制作指南:DeepSeek+豆包+即梦AI+剪映黄金工作流

大家好,我是硅基打工人! 只需3步实现AI自动化生成穿搭带货图文,日均产出效率提升10倍

TuFuir的博客 2677

java jrockit_三大Java 虚拟机垃圾回收机制的比较(HotSpot, JRockit, IBM JVM)

Hotspot JVM使用和IBM Websphere及OracleWeblogic不同的垃圾回收机制,但是垃圾回收的概念和算法是相通的。HotSpotJVM1)HotSpotJVM使用内存分区(如永久perm区和分代GenerationHeap区),分代区(Generation Heap区)又包括新生Yong区和老生Old/Tenured区,Yong区中又分为Eden区和Survior区(2块)...

weixin_26757939的博客 563

ASF-YOLO:一种基于注意尺度序列融合的细胞实例分割YOLO模型

随着样本制备技术和显微成像技术的快速发展,细胞图像的定量处理和分析在医学、细胞生物学等领域发挥着重要作用。基于卷积神经网络(CNN),可以通过神经网络训练学习不同细胞图像的特征信息,具有很强的泛化性能。两阶段的R-CNN系列[1,2,3]及其一阶段变体[4,5]是实例分割任务的经典CNN基础框架。在最近的研究中,You Only Look Once(YOLO)系列[6,7,8,9]已经成为实时实例分割中速度最快、最准确的模型之一。

m0_47867638的博客 9800

Java堆空间– JRockit和IBM VM

本文将为您提供JRockit Java堆空间与HotSpot VM的概述。 它还将为您提供有关JRockit和HotSpot的Oracle未来计划的一些背景知识。 Oracle JRockit VM Java堆:2个不同的内存空间 -Java堆(YoungGen和OldGen) -本机内存空间(类池,C堆,线程…) PermGen空间在哪里? 与IBM VM类似,JRoc...

最佳 Java 编程 391

【Cadence】Virtuoso@LayoutXL 差分电路版图镜像同步技巧详解

本文详细介绍了在Cadence Virtuoso LayoutXL中实现差分电路版图镜像同步的技巧,包括核心需求、环境配置、分步操作指南及高级技巧。通过使用LayoutXL的Group功能,工程师可以高效保持差分电路的对称性,提升版图迭代效率,确保高速信号处理的稳定性。特别适用于深亚微米工艺下的差分放大器设计。

weixin_29215391的博客 323

SST专题(2-5)MMC-SST 输入级的环流抑制

本文研究了模块化多电平换流器(MMC)的数学模型及其环流抑制控制方法。首先建立了MMC等效电路模型,推导了桥臂电流方程和虚拟电动势表达式,提出通过控制桥臂电压修正量来调节内部电流而不影响外部特性。针对MMC特有的二倍频负序环流问题,设计了基于负序旋转坐标变换的环流抑制控制器(CCSC),将时变环流转换为直流量进行控制。通过比例-积分调节和电压前馈补偿,生成内部不平衡压降参考值,最终形成包含功率控制和环流抑制的整体控制结构。仿真结果表明该方法能有效抑制内部环流,同时保持系统稳定运行。

嵌入式老牛的博客 537
上一篇: netstat Send-Q Recv-Q,端口状态说明
下一篇: Linux共享文件夹设置实例
skywolf2002
博客等级 码龄21年 6粉丝 52原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值