How "evil" is GetPrimitiveArrayCritical?
Clemens Eisserer
linuxhippy at gmail.com
Sun Dec 30 12:31:58 PST 2007
Hello,
I am currently rewriting the Deflater/Inflater classes to process data
in small chunks.
I wonder how problematic the GetPrimitiveArrayCritical functions are,
when called a lot of times and held for a ~2ms?
I have two prototypes implemented, one which copies data into small
Direct-ByteBuffers which are later accessed by JNI, and one which
accesses the array directly with GetPrimitiveArrayCritical and then
processes a limited amount of data once at a time - the worst case
time on my Core2Duo is 2ms. Most of the time it only blocks for ~500us
but sometimes it peaks up to 2ms.
However the Direct-ByteBuffer approach is a lot of code, and
introduces some copy-overhead so the GetPrimitiveArrayCritical would
be my preferred solution.
How problematic is the use of GetPrimitiveArrayCritical, and what
should be seen as a worst-case time for blocking? Does
GetPrimitiveArrayCritical has any negative effects except delaying
garbage collection for some time? Are there problems when many threads
do a lot of GetPrimitiveArrayCritical/ReleasePrimitiveArrayCritical,
even if they are short.
Can it disturb the CMS GC?
Thank you in advance, lg Clemens
More information about the hotspot-runtime-dev
mailing list