Copying in Java_java_net_SocketOutputStream_socketWrite0

Robert Stupp snazy at
Wed Apr 1 12:37:18 UTC 2015

> Am 01.04.2015 um 13:48 schrieb Alan Bateman <Alan.Bateman at>:
> On 01/04/2015 12:24, Robert Stupp wrote:
>> Is it because of pausing GC otherwise?
> Yes, GC and also that a Socket write is a potentially blocking operation. Some VMs do have a way of pinning objects in the heap (beyond JNI critical sections) but it is not assumed here.

Just want to understand ”the magic” here (sure, NIO is the way to go)…

Where’s the ”trick” to avoid GC pauses for socketWrite0 and similar methods?
Is it something hard coded like ”if JNI method is from jdk source tree”?

AFAIK there’s always a safe point w/ JNI calls. socketWrite0 is simply declared as ”JNIEXPORT void JNICALL Java_java_net_SocketOutputStream_socketWrite0” and I could not find anything in the source tree declaring ”socketWrite0” or ”SocketOutputStream” to be special (in jdk8u tree).

Robert Stupp

More information about the core-libs-dev mailing list