Subject:
[ruby-ffi] LibC.malloc buffer
From:
subsonnic
Date:
9/25/12 3:00 AM
To:
ruby-ffi@googlegroups.com

Hi,

when i create a FFI::Pointer object by LibC.malloc(8096) i get

/usr/local/lib/ruby/gems/1.9.1/gems/rsml-0.1/lib/rsml/sml_file.rb:54: [BUG] Segmentation fault
ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-linux]


Then i checked the buffer size.

p "buffer size: #{buffer.size}"             =====>            "buffer size: 9223372036854775807"

Why the buffer size is so big? How i can get a buffer width length of 8096 bytes?

I will rewrite
unsigned char buffer[8096];

Thanks for help