12 messages in net.java.dev.jna.usersRe: [jna-users] JNA problems when wor...
FromSent OnAttachments
Stas OskinSep 17, 2008 5:06 am 
Timothy WallSep 17, 2008 6:07 am 
Stas OskinSep 17, 2008 9:55 am 
Timothy WallSep 17, 2008 10:39 am 
Wayne MeissnerSep 17, 2008 10:54 am 
Stas OskinSep 17, 2008 11:07 am 
Timothy WallSep 17, 2008 11:30 am 
Stas OskinSep 18, 2008 2:00 am 
Timothy WallSep 18, 2008 5:50 am 
Stas OskinSep 18, 2008 7:37 am 
Stas OskinSep 18, 2008 11:04 am 
Timothy WallSep 18, 2008 11:29 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [jna-users] JNA problems when working with shared memoryActions...
From:Stas Oskin (stas@gmail.com)
Date:Sep 18, 2008 2:00:39 am
List:net.java.dev.jna.users

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.