On Wed, May 10, 2000 at 01:10:20PM +0100, Miles Sabin wrote:
> Matt Welsh wrote,
> I guess that in principle it ought to be possible to tweak
> JVMs to special-case a priviledged class of byte[]s to allow
> them to be pinned for an extended interval without completely
> screwing GC, but I'm not at all clear at the mo' how that could 
> be done. By the look of it the latest rev. of Jaguar might
> give me some answers.

I could swear you can actually do this with JNI. From the JNI spec:

"...Second, programmers can use another set of functions to retrieve a
pinned- down version of array elements. Keep in mind that these
functions may require the Java VM to perform storage allocation and
copying. Whether these functions in fact copy the array depends on the
VM implementation, as follows:..."


"...Our approach provides flexibility. A garbage collector algorithm
can make separate decisions about copying or pinning for each given
array. For example, the garbage collector may copy small objects, but
pin the larger objects..."

I believe the relevant API's are Get<PrimitiveType>ArrayElements() and
Release<PrimitiveType>ArrayElements.

--Chris

PGP signature

Reply via email to