def put_object(offset, obj)
      # FIXME: This is a workaround to an issue I'm seeing in
      # 1.8.7-p352 (not tested in other 1.8's).  If I used the code
      # below that works in 1.9, then inside SharedMemoryIO#write, the
      # passed string object is 'terminated' (garbage collected?) and
      # won't respond to any methods...  This way is less efficient
      # since it involves the creation of an intermediate string, but
      # it works in 1.8.7-p352.
      if RUBY_VERSION =~ /^1.8/
        str = Marshal.dump(obj)
        return put_bytes(offset, str, 0, str.size)
      end

      io = SharedMemoryIO.new(self)
      io.seek(offset)
      Marshal.dump(obj, io)
    end
def put_object(offset, obj)
      # FIXME: This is a workaround to an issue I'm seeing in
      # 1.8.7-p352 (not tested in other 1.8's).  If I used the code
      # below that works in 1.9, then inside SharedMemoryIO#write, the
      # passed string object is 'terminated' (garbage collected?) and
      # won't respond to any methods...  This way is less efficient
      # since it involves the creation of an intermediate string, but
      # it works in 1.8.7-p352.
      if RUBY_VERSION =~ /^1.8/
        str = Marshal.dump(obj)
        return put_bytes(offset, str, 0, str.size)
      end

      io = SharedMemoryIO.new(self)
      io.seek(offset)
      Marshal.dump(obj, io)
    end
Write the serialization of +obj+ (using Marshal.dump) to this
 shared memory object at +offset+ (in bytes).

 Raises IndexError if there is insufficient space.