4 messages in net.java.dev.jna.usersRe: [jna-users] corruption on byte[]
FromSent OnAttachments
Roger PackMay 21, 2009 11:03 am 
Timothy WallMay 21, 2009 11:37 am 
Roger PackMay 21, 2009 2:03 pm 
Timothy WallMay 21, 2009 4:22 pm 
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] corruption on byte[]Actions...
From:Timothy Wall (twal@dev.java.net)
Date:May 21, 2009 11:37:50 am
List:net.java.dev.jna.users

data passed via primitive array (e.g. byte[]) is only valid for the duration of the call. If you want something permanently shared between Java and native, you'll need to use Memory or a direct NIO buffer, and periodically synch changes.

you should definitely not hold a reference to the byte[]-originated memory, whether the object is long-lifed or not, because it's only a temporary view onto the array.

On May 21, 2009, at 2:04 PM, Roger Pack wrote:

Currently with 3.0.9, at least, sometimes when I pass (long lifed) byte[] through...after say 5 minutes I pass them through, they're good in java land, but corrupted in C land. Any thoughts? -=r