开发者

What is a "terminated object", and why can't I call methods on it?

Periodically I get this exception:

NotIm开发者_运维百科plementedError: method `at' called on terminated object

on this line of code:

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

What does this error mean? How can I avoid it?


The library you are using makes use of a custom C extension. In the C extension, it is trying to call a method on a Ruby object which has already been garbage-collected.

This can't happen in pure Ruby, because the garbage collector will only free objects which are no longer accessible from any reference. But in C, it is possible to have a reference remaining to a Ruby object, in a place which the garbage collector doesn't check (for example, the compiler may have put a variable in a CPU register).


It might be a linking problem. Check that you didn't link the extension twice.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜