Subject:
[ruby-ffi] Re: why FFI::MemoryPointer is autoconverted into FFI::Pointer in a FFI::Struct?
From:
Wayne Meissner
Date:
3/18/11 4:05 PM
To:
ruby-ffi@googlegroups.com


When in doubt, manage the memory yourself.

e.g. use the ffi-libc gem (https://github.com/postmodern/ffi-libc) , and then use FFI::LibC.malloc() to allocate the memory, and FFI::LibC.free() to release it when the memory is no longer needed.

Or, as chuck says, use attach_function to map in malloc and free yourself.