[concurrency-interest] JVM crash when using Unsafe to read/write bytes in Java 8 (no crash with same code in Java 7)
ggu at quartetfs.com
Thu Sep 18 07:53:55 EDT 2014
Thanks for the suggestion, but I've tried allocating extra 16 bytes and
even extra 1024 bytes, and it still fails.
On Thu, Sep 18, 2014 at 1:34 PM, Stanimir Simeonoff <stanimir at riflexo.com>
> I suppose the problem occurs due to the last few (less than 8) bytes are
> addressed. Probably getByte(address) won't read just a byte but a 32/64
> word and mask+shift it.
> Try to allocate extra 16 bytes instead of 8.
> On Thu, Sep 18, 2014 at 1:38 PM, Gaëlle Guimezanes <ggu at quartetfs.com>
>> I am sorry this is not really a concurrency problem since it can be
>> reproduced using only one thread, but I didn't really know where to discuss
>> this. Since many of you use Unsafe I thought you might be able to help me
>> understand what's happening or direct me to the correct mailing list.
>> 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
>> 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.
>> I also have attached crash reports :
>> hs_err_pid5480.log for the crash on windows
>> hs_err_pid7210.log for the crash on linux
>> Thank you for your attention,
>> Best regards,
>> Gaëlle Guimezanes.
>> Concurrency-interest mailing list
>> Concurrency-interest at cs.oswego.edu
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Concurrency-interest