Ruby 3.1.3p185 (2022-11-24 revision 1a6b16756e0ba6b95ab71a441357ed5484e33498)
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. More...
 
void rb_global_variable (VALUE *)
 An alias for rb_gc_register_address(). More...
 
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. More...
 
void rb_gc_register_mark_object (VALUE object)
 Inform the garbage collector that object is a live Ruby object that should not be moved. More...
 

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 8707 of file gc.c.

Referenced by rb_global_variable(), and ruby_init_loadpath().

◆ 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 8686 of file gc.c.

Referenced by rb_define_const(), rb_profile_frame_absolute_path(), and ruby_process_options().

◆ 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 8719 of file gc.c.

◆ rb_global_variable()

void rb_global_variable ( VALUE var)

An alias for rb_gc_register_address().

Definition at line 8742 of file gc.c.