user3198603 user3198603 - 7 months ago 9
Java Question

what is pinned objectoverflow?

Recently we have got pinned object overflow error in production environment. I did google but did not get much about it.

Can someone explain

1)what is pinning object ?

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

3)possible cases when pinned objectoverflow can happen ?

Answer

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

1)what is pinning object ?

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.

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

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().

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).

3)possible cases when pinned objectoverflow can happen ?

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.