Subject:
[ruby-ffi] Re: c++ examples
From:
rogerdpack
Date:
12/9/09 12:53 PM
To:
ruby-ffi

> I do not recommend this at all. Using finalizers to release external resources is a very easy way to cause memory leaks and latent bugs.

Anybody know if collection at finalize time what the following code
(from the tutorial) does by default?

module MyLibrary
  class SomeObject < FFI::ManagedStruct
    layout :next,  :pointer,
           :name,  :string,
           :value, :double,

    def self.release(ptr)
      MyLibrary.free_object(ptr)
    end
  end
end
Thanks.
-r