Hi.
Note that this is only the case for when
jna.protected=true/Native.setProtected(true). Otherwise it's up to you
whether you want entry to your library synchronized.
I see - any benefits to this approach when working with JNA?
This isn't really any different than you already knew. The Pointer's peer
value seems to be bogus, which causes the read of a byte array from native
memory to fail. The VM signal handler catches the SEGV and dumps.
I still trying to catch this crash (and learning Java debug tools) - mind
checking the jstack dump below?
Thread 29488: (state = IN_NATIVE)
- com.sun.jna.Pointer._getInt(long) @bci=0 (Compiled frame; information may
be imprecise)
- com.sun.jna.Pointer.getInt(long) @bci=6, line=427 (Compiled frame)
- com.sun.jna.Structure.readValue(int, java.lang.Class, java.lang.Object)
@bci=145, line=393 (Compiled frame)
- com.sun.jna.Structure.readField(com.sun.jna.Structure$StructField)
@bci=108, line=367 (Compiled frame)
- com.sun.jna.Structure.read() @bci=79, line=282 (Compiled frame)
- org.mem.VZFRAME.useMemory(com.sun.jna.Pointer, int) @bci=7, line=18
(Compiled frame)
- com.sun.jna.Structure.useMemory(com.sun.jna.Pointer) @bci=3, line=187
(Compiled frame)
- org.mem.VZFRAME.useMemory(com.sun.jna.Pointer) @bci=2, line=12 (Compiled
frame)
- org.mem.memoryManage.getRowNumber() @bci=8, line=83 (Compiled frame)
- org.update.threads.CalcDataThread.run() @bci=32, line=31 (Compiled frame)
Also, I have a question - why in stack the code seems to go to JNA
(com.sun.jna.Structure.useMemory(com.sun.jna.Pointer)), returns to my code
(org.mem.VZFRAME.useMemory()) and then goes to JNA back again
(com.sun.jna.Structure.read())? I mean, shouldn't it be one way?
Regards.