[concurrency-interest] DirectByteBuffers and reachabilityFence

Alexandre De Champeaux adc at quartetfs.com
Wed Dec 9 12:39:40 EST 2015

> This is why I suggested to ask the Hotspot compiler devs who may be able
> to answer this (relatively) quickly and definitively, or at least as
> definitive as we'll get at this point.  Jason's example? You mean
> Alexandre's? The only case demonstrated in this thread that actually
> segfaults is what Alexandre showed, but as mentioned a few times, it's
> slightly different from DBB.
Well it's not that different from the get() method of a DBB.
If you like, you can replace the copy method of my previous example with
something like

public byte[] copy() {
final byte[] a = new byte[1];
final long addr = this.addr;
if (ctr++ >= 31_000l * 1000) {
// Counter is there to wait for JIT compilation
System.out.println("Must be compiled now, start doing some GCs " + ctr);
// Here we simulate a safepoint, and a GC at this safepoint
try {
// And here we wait for the reference handler to perform the cleaning to
simulate a fast cleaning.
} catch (InterruptedException e) {
a[0] = unsafe.getByte(addr);
return a;

This crashes as well.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20151209/9385b7fa/attachment.html>

More information about the Concurrency-interest mailing list