Ruby 3.2.4p170 (2024-04-23 revision af471c0e0127eea0cafa6f308c0425bbfab0acf5)
Functions
gc.h File Reference

Registering values to the GC. More...

#include "ruby/internal/dllexport.h"
#include "ruby/internal/value.h"

Go to the source code of this file.

Functions

void rb_gc_register_address (VALUE *valptr)
 Inform the garbage collector that valptr points to a live Ruby object that should not be moved.
 
void rb_global_variable (VALUE *)
 An alias for rb_gc_register_address().
 
void rb_gc_unregister_address (VALUE *valptr)
 Inform the garbage collector that a pointer previously passed to rb_gc_register_address() no longer points to a live Ruby object.
 
void rb_gc_register_mark_object (VALUE object)
 Inform the garbage collector that object is a live Ruby object that should not be moved.
 

Detailed Description

Registering values to the GC.

Author
Ruby developers ruby-.nosp@m.core.nosp@m.@ruby.nosp@m.-lan.nosp@m.g.org
Warning
Symbols prefixed with either RBIMPL or rbimpl are implementation details. Don't take them as canon. They could rapidly appear then vanish. The name (path) of this header file is also an implementation detail. Do not expect it to persist at the place it is now. Developers are free to move it anywhere anytime at will.
Note
To ruby-core: remember that this header can be possibly recursively included from extension libraries written in C++. Do not expect for instance __VA_ARGS__ is always available. We assume C99 for ruby itself but we don't assume languages of extension libraries. They could be written in C++98.

Definition in file gc.h.

Function Documentation

◆ rb_gc_register_address()

void rb_gc_register_address ( VALUE * valptr)

Inform the garbage collector that valptr points to a live Ruby object that should not be moved.

Note that extensions should use this API on global constants instead of assuming constants defined in Ruby are always alive. Ruby code can remove global constants.

Definition at line 9279 of file gc.c.

◆ rb_gc_register_mark_object()

void rb_gc_register_mark_object ( VALUE object)

Inform the garbage collector that object is a live Ruby object that should not be moved.

See also: rb_gc_register_address()

Definition at line 9258 of file gc.c.

◆ rb_gc_unregister_address()

void rb_gc_unregister_address ( VALUE * valptr)

Inform the garbage collector that a pointer previously passed to rb_gc_register_address() no longer points to a live Ruby object.

Definition at line 9291 of file gc.c.

◆ rb_global_variable()

void rb_global_variable ( VALUE * var)

An alias for rb_gc_register_address().

Definition at line 9314 of file gc.c.