What is a "completed object" and why can not I call methods on it?

Periodically I get this exception:

NotImplementedError: method `at' called on terminated object 

in this line of code:

 next if Hpricot(html).at('a') 

What does this error mean? How can i avoid this?

+6
ruby hpricot
source share
2 answers

The library used uses the custom extension C. In extension C, he tries to call a method on a Ruby object that has already been garbage collected.

This cannot happen in pure Ruby, because the garbage collector will only free objects that are no longer available from any link. But in C, you can leave a link to a Ruby object in a place where the garbage collector does not check (for example, the compiler can put a variable in the CPU register).

+1
source share

This may be a binding problem. Make sure you do not bind the extension twice.

0
source share

All Articles