开发者

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

开发者 https://www.devze.com 2023-02-04 23:09 出处:网络
Periodically I get this exception: NotIm开发者_运维百科plementedError: method `at\' called on terminated object

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

精彩评论

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