Duplicate :
|
|
Relates :
|
|
Relates :
|
http://cs.oswego.edu/pipermail/concurrency-interest/2014-September/012953.html Date: Thu, 18 Sep 2014 12:38:59 +0200 From: Ga��lle Guimezanes <ggu@quartetfs.com> To: concurrency-interest@cs.oswego.edu [...] I have a strange behaviour using Unsafe in Java 1.8.0_20. When I use getByte/putByte to manipulate bits, my JVM crashes (access violation). But when I use getLong/putLong for the same purpose it works correctly (even though I have allocated exactly the same amount of memory). Also, when using Java 1.7.0_67 to compile and run the same source code, both the getByte/putByte and the getLong/putLong approaches work correctly. I have attached a simple test class (DirectMemoryCrash.java) for reproducing the problem: you can run it with no argument for the getByte/putByte version, or with "useLongs" arguments for the getLong/putLong version. [...] # # A fatal error has been detected by the Java Runtime Environment: # # SIGSEGV (0xb) at pc=0x00007fec9130336a, pid=228310, tid=140654375552768 # # JRE version: OpenJDK Runtime Environment (9.0) (build 1.9.0-internal-debug-vlivanov_2014_09_18_07_56-b00) # Java VM: OpenJDK 64-Bit Server VM (1.9.0-internal-debug-vlivanov_2014_09_18_07_56-b00 mixed mode linux-amd64 compressed oops) # Problematic frame: # J 270% C1 DirectMemoryCrash.alternateBitsUsingBytes(I)V (181 bytes) @ 0x00007fec9130336a [0x00007fec91302d00+0x66a] # ILW = HLH = P2 I = H = crash w/ product binaries L = L = problematic code shape involves Unsafe usage W = H = no workaround is known
|