Use write_ulong for writing size_t

This fixes the seg fault with jRuby and now all tests pass.

However, I think I'm going to use my ffi_no_malloc branch so I don't
have to worry about freeing the memory.