On Mar 5, 2008, at 10:37 PM, Lei Ding wrote:
Hello Timothy and all,
JNA overall is working grealty for me, but a few times it does
crashes VM, like a frequent call of toArray, and maybe even just
some random call to user32 functions(frequent and rapid calls).
INPUT[] inputs = (INPUT[])new INPUT().toArray(2);
This by itself shouldn't cause any problems. The structure memory is
cleared when allocated, so it's not like you'd get random data in the
structure, at least when allocated with "new". Are you accessing or
calling user32 functions from multiple threads?
I am not sure if there's anythign wrong with this statement. Because
this sometimes works for me, sometimes crashes VM. By the way,
before creating new INPUT, this method also does VirtuaAlloc and
VirtualFree to access other process's window control, not sure if
that might affect it.
Here's the VM log:
Current thread (0x003f5c00): JavaThread "main" [_thread_in_native,
id=2524, stack(0x008d0000,0x00920000)]
siginfo: ExceptionCode=0xc0000005, reading address 0xfffffff8
Consider where you might have generated that address. Note that it
has integer value "-8", which looks like something is trying to access
8 bytes ahead of a null pointer. Are you using any data objects for
which the system expects to be able to access something ahead of the
actual data pointer (there's an MS string variation that does this)?