@Test
public void test1() {
ByteBuffer buffer1 = ByteBuffer.allocateDirect(8 * 6);
buffer1.asDoubleBuffer().put(new double[]{1, 2, 3, 4, 5, 6});
ByteBuffer buffer2 = ByteBuffer.wrap(new byte[]{63, -16, 0, 0, 0, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 64, 8, 0, 0, 0, 0, 0, 0, 64, 16, 0, 0, 0, 0, 0, 0, 64, 20, 0, 0, 0, 0, 0, 0, 64, 24, 0, 0, 0, 0, 0, 0});
assertThat(buffer1).isEqualTo(buffer2);
DataBuffer dataBuffer1 = Nd4j.createBuffer(buffer1, DataType.DOUBLE, 6, 0);
DataBuffer dataBuffer2 = Nd4j.createBuffer(buffer2, DataType.DOUBLE, 6, 0); // <~~ crashes the JVM on this line
assertThat(dataBuffer1.asDouble()).isEqualTo(dataBuffer2.asDouble());
}
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x000000018b2503f4, pid=83713, tid=3843
#
# JRE version: Java(TM) SE Runtime Environment Oracle GraalVM 21.0.2+13.1 (21.0.2+13) (build 21.0.2+13-LTS-jvmci-23.1-b30)
# Java VM: Java HotSpot(TM) 64-Bit Server VM Oracle GraalVM 21.0.2+13.1 (21.0.2+13-LTS-jvmci-23.1-b30, mixed mode, sharing, tiered, jvmci, jvmci compiler, compressed oops, compressed class ptrs, g1 gc, bsd-aarch64)
# Problematic frame:
# C [libsystem_platform.dylib+0x33f4] _platform_memmove+0x1a4
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /Users/xxx/hs_err_pid83713.log
#
# If you would like to submit a bug report, please visit:
# https://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
Process finished with exit code 134 (interrupted by signal 6:SIGABRT)
crashes the JVM: