

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
13 messages in net.java.dev.jna.usersRe: [jna-users] Some questions about ...| From | Sent On | Attachments |
|---|---|---|
| Albert Strasheim | Jan 6, 2009 11:33 am | |
| Timothy Wall | Jan 6, 2009 11:58 am | |
| Albert Strasheim | Jan 6, 2009 12:08 pm | |
| Timothy Wall | Jan 6, 2009 12:12 pm | |
| Timothy Wall | Jan 6, 2009 12:14 pm | |
| Albert Strasheim | Jan 6, 2009 12:21 pm | |
| Timothy Wall | Jan 6, 2009 12:29 pm | |
| Albert Strasheim | Jan 6, 2009 12:37 pm | |
| Daniel Kaufmann | Jan 6, 2009 4:26 pm | |
| Albert Strasheim | Jan 6, 2009 6:38 pm | .diff |
| Albert Strasheim | Jan 8, 2009 7:30 pm | |
| Paul Loy | Jan 9, 2009 1:40 am | |
| Timothy Wall | Jan 9, 2009 4:45 am |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | Re: [jna-users] Some questions about com.sun.jna.Memory | Actions... |
|---|---|---|
| From: | Daniel Kaufmann (dani...@gmail.com) | |
| Date: | Jan 6, 2009 4:26:07 pm | |
| List: | net.java.dev.jna.users | |
Regarding posix_memalign, it looks like Solaris is going to have it in version 11, not sure if already available in some patch for version 10. ( http://bugs.opensolaris.org/view_bug.do?bug_id=6669307.) However, it seem to be missing in several plataforms according to this link: http://www.gnu.org/software/gnulib/manual/html_node/posix_005fmemalign.html In windows the CRT provides the following function for this: _aligned_malloc, but accordin to the documentation it is just based on malloc. -Daniel
On 1/6/09, Albert Strasheim <full...@gmail.com> wrote:
Hello,
On Tue, Jan 6, 2009 at 9:59 PM, Timothy Wall <twal...@dev.java.net> wrote:
On Jan 6, 2009, at 2:34 PM, Albert Strasheim wrote:
It seems like it would be more useful if Memory's align and share methods returned Memory instead of Pointer. This change would allow one to call getSize() on the SharedMemory returned when using these methods to check on the size of the new buffer.
It'd also be nice if alignment simply allocated enough memory if it didn't have it. This would probably need to be implemented as an option to align, though, since there are probably cases where you *don't* want to reallocate a buffer.
Agreed.
Yeah. Is there any system-independent way to allocate aligned memory though, short of asking for a block big enough to align it?
Not that I know of. Linux has posix_memalign(3). I don't know about other platforms. For my application this trick is fine.
I also think it could be useful if one could explicitly call free() on a Memory instance instead of relying on the finalizer. This becomes useful when one is dealing with many large buffers that use up most of the available memory.
There used to be an explicit "free" in the original JNA CVS codebase, but I removed it because it wasn't referenced internally and made necessary checks for validity everywhere. At the time I thought it was a lot cleaner to not have to worry about Memory being invalid until it was GCd. In this case, making an ExplicitlyFreeableMemory class if you need it keeps the core implementation simpler.
It seems I can't make this class in my own package because Pointer's constructors are package-private. I am missing something, or is this something that could be changed?
Regards,
Albert








.diff