7 messages in net.java.dev.jna.usersRe: [jna-users] Memory allocated for ...
FromSent OnAttachments
Mike PilsburySep 16, 2008 6:52 am 
Timothy WallSep 16, 2008 7:05 am 
Mike PilsburySep 16, 2008 7:26 am 
Mike PilsburySep 17, 2008 1:38 am 
Timothy WallSep 17, 2008 5:23 am 
Mike PilsburySep 17, 2008 6:27 am 
Timothy WallSep 17, 2008 7:11 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] Memory allocated for a structureActions...
From:Timothy Wall (twal@dev.java.net)
Date:Sep 16, 2008 7:05:43 am
List:net.java.dev.jna.users

On Sep 16, 2008, at 9:52 AM, Mike Pilsbury wrote:

When the code below is executed, will the same area of memory be used for the structure in both method calls? Or will a fresh block be allocated for each call?

{ MyStructure s = new MyStructure(); // extends Structure

This allocates a block the size of the structure, which is associated with "s" until either "useMemory" is called with a different block or the object is GC'd.

... native_1(s); native_2(s); }

If different areas, then it may explain some weirdness I'm experiencing. In which case, how can I ensure that the same area of memory is used?

If it will use the same area, then I'll have to look for another reason for the strange behaviour.

Note that implicit calls to Structure.write and Structure.read are before and after native invocations, respectively.