什么是固定对象溢出

什么是固定对象溢出

本文介绍了什么是固定对象溢出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近我们在生产环境中遇到了固定的对象溢出错误,例如

Recently we have got pinned object overflow error in production environment, e.g.

Caused by: java.lang.InternalError: pinned object overflow!

请您解释一下

1)什么是固定对象?

1) What is a pinned object ?

2)JVM是在内部完成还是可以通过编程方式完成?

2) Does JVM do it internally or can it be done programmatically also ?

3)固定对象溢出的可能情况是什么?

3) Possible cases when pinned object overflow can happen ?

推荐答案

好的,我们假设您正在使用JRockit.

ok, we will assume that you are working with JRockit.

固定的对象是不允许移动的对象.通常,如果一个对象正在被提升或作为压缩的一部分,则可能会从一个地址移动到另一个地址.但是,如果固定了一个对象,则在取消固定之前,GC不会尝试移动它.基本上,这意味着有人可以指向对象的内存地址,而JVM必须将对象保持在原处.

A pinned object is one that is not allowed to move. Normally, an object might be moved from one address to another if it is being promoted or as part of compaction. But if an object is pinned, the GC will not try to move it until it is unpinned. This basically means that someone has a pointer to the memory address of an object and JVM have to keep the object in place.

据我所知,只能以编程方式完成.例如,以下JNI方法允许直接访问JVM所保存的数据(*env)->GetPrimitiveArrayCritical().

As far as I know it can be done only programmatically. For example, the following JNI method allows direct access to the data held by the JVM(*env)->GetPrimitiveArrayCritical().

JRockit还进行了性能优化-在I/O操作期间固定缓冲区,从而可以将其地址直接传递给操作系统.可以通过调用*InputStream*OutputStream中的任何方法来隐式使用此优化(请参见此处).

Also JRockit has a performance optimization - pinning a buffer during an I/O operation which allows to hand it's address directly to the operating system. This optimization is used implicitly by calling any method in *InputStream or *OutputStream(See details here).

有很多情况-JNI调用中的问题,I/O调用中的不良异常处理.为了更精确,我们必须具有堆转储或分析结果(JRockit Mission Control).我们首先要看的是I/O中阻塞的堆栈数量或*InputStream实例的数量.

There are a lot of cases - issues in JNI call, bad exception handling in I/O calls. In order to be more precise we have to have heap dumps or profiling results(JRockit Mission Control). The first thing we have to look at is amount of stacks blocked in I/O or amount of *InputStream instances.

这篇关于什么是固定对象溢出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-02 02:44