pub unsafe extern "C" fn rb_define_finalizer(
obj: VALUE,
block: VALUE,
) -> VALUEExpand description
Assigns a finaliser for an object. Each objects can have objects (typically blocks) that run immediately after that object dies. They are called finalisers of an object. This function associates a finaliser object with a target object.
@note Note that finalisers run after the object they finalise dies. You cannot for instance call its methods. @note If your finaliser references the object it finalises that object loses any chance to become a garbage; effectively leaks memory until the end of the process.
§@param[in] obj Target to finalise.
@param[in] block Something callable.
@exception rb_eRuntimeError Somehow obj cannot have finalisers.
@exception rb_eFrozenError obj is frozen.
@exception rb_eArgError block doesn’t respond to call.
@return The passed block.
@post block runs after obj dies.
Generated by rb-sys for Ruby mri-x86_64-linux-gnu-3.3.8