Subject:
[ruby-ffi] Re: FFI::ManagedStruct #release method
From:
Wayne Meissner
Date:
10/20/13 10:03 PM
To:
ruby-ffi@googlegroups.com

Thats the current behaviour - the problem with "raise exception", is ... where does it raise the exception, since the release method is called from a GC thread, which has to quash any exceptions, since it should never die.

On the other hand, I am open to suggestions on how to make debugging this easier, since it is likely to bite more people.


On Monday, 21 October 2013 13:26:25 UTC+11, Levi Wilson wrote:
I'm using FFI::ManagedStruct in a project of mine to be sure to clean up my memory. The question I have is around what happens if that call fails. The reason that I ask is because I had renamed the function and forgot to reflect this in the self.release definition. I expected this to raise an exception as my function wasn't defined. Is there a way to make this more obvious to me if this happens again?

class MyManagedStruct < FFI::ManagedStruct
  layout :name, :string,
            :ids, :pointer,
            :ids_length, :int

  def self.release
    MyLibrary.release_my_struct
    # MyLibrary.oops_this_is_not_named_correctly does not fail
  end
end

Thanks in advance,

Levi

--
 
---
You received this message because you are subscribed to the Google Groups "ruby-ffi" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ruby-ffi+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.