Ruby: gc.c File Reference

Ruby 3.0.5p211 (2022-11-24 revision ba5cf0f7c52d4d35cc6a173c89eda98ceffa2dcf)

Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
gc.c File Reference
`#include "ruby/internal/config.h"`
`#include <signal.h>`
`#include <unistd.h>`
`#include <sys/mman.h>`
`#include <setjmp.h>`
`#include <stdarg.h>`
`#include <stdio.h>`
`#include <sys/types.h>`
`#include "constant.h"`
`#include "debug_counter.h"`
`#include "eval_intern.h"`
`#include "gc.h"`
`#include "id_table.h"`
`#include "internal.h"`
`#include "internal/class.h"`
`#include "internal/complex.h"`
`#include "internal/cont.h"`
`#include "internal/error.h"`
`#include "internal/eval.h"`
`#include "internal/gc.h"`
`#include "internal/hash.h"`
`#include "internal/imemo.h"`
`#include "internal/io.h"`
`#include "internal/numeric.h"`
`#include "internal/object.h"`
`#include "internal/proc.h"`
`#include "internal/rational.h"`
`#include "internal/sanitizers.h"`
`#include "internal/struct.h"`
`#include "internal/symbol.h"`
`#include "internal/thread.h"`
`#include "internal/variable.h"`
`#include "internal/warnings.h"`
`#include "mjit.h"`
`#include "probes.h"`
`#include "regint.h"`
`#include "ruby/debug.h"`
`#include "ruby/io.h"`
`#include "ruby/re.h"`
`#include "ruby/st.h"`
`#include "ruby/thread.h"`
`#include "ruby/util.h"`
`#include "ruby_assert.h"`
`#include "ruby_atomic.h"`
`#include "symbol.h"`
`#include "transient_heap.h"`
`#include "vm_core.h"`
`#include "vm_sync.h"`
`#include "vm_callinfo.h"`
`#include "ractor_core.h"`
`#include "builtin.h"`
`#include "gc.rbinc"`

Go to the source code of this file.

## Data Structures
struct | ruby_gc_params_t
struct | gc_profile_record
struct | RMoved
struct | RVALUE
struct | heap_page_header
struct | heap_page_body
struct | gc_list
struct | stack_chunk
struct | mark_stack
struct | rb_heap_struct
struct | rb_objspace
struct | heap_page
struct | RZombie
struct | cc_tbl_i_data
struct | each_obj_args
struct | os_each_struct
struct | force_finalize_list
struct | verify_internal_consistency_struct
struct | objspace_and_reason
struct | root_objects_data
struct | gc_raise_tag
struct | malloc_obj_info
struct | weakmap
struct | wmap_iter_arg

## Macros
#define | rb_data_object_alloc rb_data_object_alloc
#define | rb_data_typed_object_alloc rb_data_typed_object_alloc
#define | sighandler_t ruby_sighandler_t
#define | rb_setjmp(env) RUBY_SETJMP(env)
#define | rb_jmp_buf rb_jmpbuf_t
#define | GC_HEAP_INIT_SLOTS 10000
#define | GC_HEAP_FREE_SLOTS 4096
#define | GC_HEAP_GROWTH_FACTOR 1.8
#define | GC_HEAP_GROWTH_MAX_SLOTS 0 /* 0 is disable */
#define | GC_HEAP_OLDOBJECT_LIMIT_FACTOR 2.0
#define | GC_HEAP_FREE_SLOTS_MIN_RATIO 0.20
#define | GC_HEAP_FREE_SLOTS_GOAL_RATIO 0.40
#define | GC_HEAP_FREE_SLOTS_MAX_RATIO 0.65
#define | GC_MALLOC_LIMIT_MIN (16 * 1024 * 1024 /* 16MB */)
#define | GC_MALLOC_LIMIT_MAX (32 * 1024 * 1024 /* 32MB */)
#define | GC_MALLOC_LIMIT_GROWTH_FACTOR 1.4
#define | GC_OLDMALLOC_LIMIT_MIN (16 * 1024 * 1024 /* 16MB */)
#define | GC_OLDMALLOC_LIMIT_GROWTH_FACTOR 1.2
#define | GC_OLDMALLOC_LIMIT_MAX (128 * 1024 * 1024 /* 128MB */)
#define | PRINT_MEASURE_LINE 0
#define | PRINT_ENTER_EXIT_TICK 0
#define | PRINT_ROOT_TICKS 0
#define | USE_TICK_T (PRINT_ENTER_EXIT_TICK || PRINT_MEASURE_LINE || PRINT_ROOT_TICKS)
#define | TICK_TYPE 1
#define | GC_DEBUG 0
#define | RGENGC_DEBUG 0
#define | RGENGC_DEBUG_ENABLED(level) 0
#define | RGENGC_CHECK_MODE 0
#define | GC_ASSERT(expr) RUBY_ASSERT_MESG_WHEN(RGENGC_CHECK_MODE > 0, expr, #expr)
#define | RGENGC_OLD_NEWOBJ_CHECK 0
#define | RGENGC_PROFILE 0
#define | RGENGC_ESTIMATE_OLDMALLOC 1
#define | RGENGC_FORCE_MAJOR_GC 0
#define | GC_PROFILE_MORE_DETAIL 0
#define | GC_PROFILE_DETAIL_MEMORY 0
#define | GC_ENABLE_INCREMENTAL_MARK USE_RINCGC
#define | GC_ENABLE_LAZY_SWEEP 1
#define | CALC_EXACT_MALLOC_SIZE USE_GC_MALLOC_OBJ_INFO_DETAILS
#define | MALLOC_ALLOCATED_SIZE 0
#define | MALLOC_ALLOCATED_SIZE_CHECK 0
#define | GC_DEBUG_STRESS_TO_CLASS 0
#define | RGENGC_OBJ_INFO (RGENGC_DEBUG | RGENGC_CHECK_MODE)
#define | FL_FROM_FREELIST FL_USER0
#define | RMOVED(obj) ((struct RMoved *)(obj))
#define | popcount_bits rb_popcount_intptr
#define | STACK_CHUNK_SIZE 500
#define | HEAP_PAGE_ALIGN_LOG 14
#define | CEILDIV(i, mod) (((i) + (mod) - 1)/(mod))
#define | GET_PAGE_BODY(x) ((struct heap_page_body *)((bits_t)(x) & ~(HEAP_PAGE_ALIGN_MASK)))
#define | GET_PAGE_HEADER(x) (&GET_PAGE_BODY(x)->header)
#define | GET_HEAP_PAGE(x) (GET_PAGE_HEADER(x)->page)
#define | NUM_IN_PAGE(p) (((bits_t)(p) & HEAP_PAGE_ALIGN_MASK)/sizeof(RVALUE))
#define | BITMAP_INDEX(p) (NUM_IN_PAGE(p) / BITS_BITLENGTH )
#define | BITMAP_OFFSET(p) (NUM_IN_PAGE(p) & (BITS_BITLENGTH-1))
#define | BITMAP_BIT(p) ((bits_t)1 << BITMAP_OFFSET(p))
#define | MARKED_IN_BITMAP(bits, p) ((bits)[BITMAP_INDEX(p)] & BITMAP_BIT(p))
#define | MARK_IN_BITMAP(bits, p) ((bits)[BITMAP_INDEX(p)] = (bits)[BITMAP_INDEX(p)] | BITMAP_BIT(p))
#define | CLEAR_IN_BITMAP(bits, p) ((bits)[BITMAP_INDEX(p)] = (bits)[BITMAP_INDEX(p)] & ~BITMAP_BIT(p))
#define | GET_HEAP_MARK_BITS(x) (&GET_HEAP_PAGE(x)->mark_bits[0])
#define | GET_HEAP_PINNED_BITS(x) (&GET_HEAP_PAGE(x)->pinned_bits[0])
#define | GET_HEAP_UNCOLLECTIBLE_BITS(x) (&GET_HEAP_PAGE(x)->uncollectible_bits[0])
#define | GET_HEAP_WB_UNPROTECTED_BITS(x) (&GET_HEAP_PAGE(x)->wb_unprotected_bits[0])
#define | GET_HEAP_MARKING_BITS(x) (&GET_HEAP_PAGE(x)->marking_bits[0])
#define | rb_objspace (*rb_objspace_of(GET_VM()))
#define | rb_objspace_of(vm) ((vm)->objspace)
#define | ruby_initial_gc_stress gc_params.gc_stress
#define | malloc_limit objspace->malloc_params.limit
#define | malloc_increase objspace->malloc_params.increase
#define | malloc_allocated_size objspace->malloc_params.allocated_size
#define | heap_pages_sorted objspace->heap_pages.sorted
#define | heap_allocated_pages objspace->heap_pages.allocated_pages
#define | heap_pages_sorted_length objspace->heap_pages.sorted_length
#define | heap_pages_lomem objspace->heap_pages.range[0]
#define | heap_pages_himem objspace->heap_pages.range[1]
#define | heap_allocatable_pages objspace->heap_pages.allocatable_pages
#define | heap_pages_freeable_pages objspace->heap_pages.freeable_pages
#define | heap_pages_final_slots objspace->heap_pages.final_slots
#define | heap_pages_deferred_final objspace->heap_pages.deferred_final
#define | heap_eden (&objspace->eden_heap)
#define | heap_tomb (&objspace->tomb_heap)
#define | during_gc objspace->flags.during_gc
#define | finalizing objspace->atomic_flags.finalizing
#define | finalizer_table objspace->finalizer_table
#define | global_list objspace->global_list
#define | ruby_gc_stressful objspace->flags.gc_stressful
#define | ruby_gc_stress_mode objspace->gc_stress_mode
#define | stress_to_class 0
#define | dont_gc_on() (objspace->flags.dont_gc = 1)
#define | dont_gc_off() (objspace->flags.dont_gc = 0)
#define | dont_gc_set(b) (((int)b), objspace->flags.dont_gc = (b))
#define | dont_gc_val() (objspace->flags.dont_gc)
#define | gc_mode(objspace) gc_mode_verify((enum gc_mode)(objspace)->flags.mode)
#define | gc_mode_set(objspace, mode) ((objspace)->flags.mode = (unsigned int)gc_mode_verify(mode))
#define | is_marking(objspace) (gc_mode(objspace) == gc_mode_marking)
#define | is_sweeping(objspace) (gc_mode(objspace) == gc_mode_sweeping)
#define | is_full_marking(objspace) ((objspace)->flags.during_minor_gc == FALSE)
#define | is_incremental_marking(objspace) FALSE
#define | will_be_incremental_marking(objspace) FALSE
#define | has_sweeping_pages(heap) ((heap)->sweeping_page != 0)
#define | is_lazy_sweeping(heap) (GC_ENABLE_LAZY_SWEEP && has_sweeping_pages(heap))
#define | nonspecial_obj_id(obj) (VALUE)((SIGNED_VALUE)(obj)|FIXNUM_FLAG)
#define | obj_id_to_ref(objid) ((objid) ^ FIXNUM_FLAG) /* unset FIXNUM_FLAG */
#define | RANY(o) ((RVALUE*)(o))
#define | RZOMBIE(o) ((struct RZombie *)(o))
#define | nomem_error GET_VM()->special_exceptions[ruby_error_nomemory]
#define | TYPED_UPDATE_IF_MOVED(_objspace, _type, _thing)
#define | UPDATE_IF_MOVED(_objspace, _thing) TYPED_UPDATE_IF_MOVED(_objspace, VALUE, _thing)
#define | gc_prof_record(objspace) (objspace)->profile.current_record
#define | gc_prof_enabled(objspace) ((objspace)->profile.run && (objspace)->profile.current_record)
#define | gc_report(level, objspace, ...) if (!RGENGC_DEBUG_ENABLED(level)) {} else gc_report_body(level, objspace, __VA_ARGS__)
#define | MEASURE_LINE(expr) expr
#define | FL_CHECK2(name, x, pred)
#define | FL_TEST2(x, f) FL_CHECK2("FL_TEST2", x, FL_TEST_RAW((x),(f)) != 0)
#define | FL_SET2(x, f) FL_CHECK2("FL_SET2", x, RBASIC(x)->flags |= (f))
#define | FL_UNSET2(x, f) FL_CHECK2("FL_UNSET2", x, RBASIC(x)->flags &= ~(f))
#define | RVALUE_MARK_BITMAP(obj) MARKED_IN_BITMAP(GET_HEAP_MARK_BITS(obj), (obj))
#define | RVALUE_PIN_BITMAP(obj) MARKED_IN_BITMAP(GET_HEAP_PINNED_BITS(obj), (obj))
#define | RVALUE_PAGE_MARKED(page, obj) MARKED_IN_BITMAP((page)->mark_bits, (obj))
#define | RVALUE_WB_UNPROTECTED_BITMAP(obj) MARKED_IN_BITMAP(GET_HEAP_WB_UNPROTECTED_BITS(obj), (obj))
#define | RVALUE_UNCOLLECTIBLE_BITMAP(obj) MARKED_IN_BITMAP(GET_HEAP_UNCOLLECTIBLE_BITS(obj), (obj))
#define | RVALUE_MARKING_BITMAP(obj) MARKED_IN_BITMAP(GET_HEAP_MARKING_BITS(obj), (obj))
#define | RVALUE_PAGE_WB_UNPROTECTED(page, obj) MARKED_IN_BITMAP((page)->wb_unprotected_bits, (obj))
#define | RVALUE_PAGE_UNCOLLECTIBLE(page, obj) MARKED_IN_BITMAP((page)->uncollectible_bits, (obj))
#define | RVALUE_PAGE_MARKING(page, obj) MARKED_IN_BITMAP((page)->marking_bits, (obj))
#define | RVALUE_OLD_AGE 3
#define | RVALUE_AGE_SHIFT 5 /* FL_PROMOTED0 bit */
#define | gc_event_hook_available_p(objspace) ((objspace)->flags.has_hook)
#define | gc_event_hook_needed_p(objspace, event) ((objspace)->hook_events & (event))
#define | gc_event_hook_prep(objspace, event, data, prep)
#define | gc_event_hook(objspace, event, data) gc_event_hook_prep(objspace, event, data, (void)0)
#define | UNEXPECTED_NODE(func)
#define | IMEMO_NAME(x) case imemo_##x: return #x;
#define | OBJ_ID_INCREMENT (sizeof(RVALUE) / 2)
#define | OBJ_ID_INITIAL (OBJ_ID_INCREMENT * 2)
#define | RESTORE_FINALIZER()
#define | NUM2PTR(x) NUM2ULONG(x)
#define | COUNT_TYPE(t) case (t): return ID2SYM(rb_intern(#t)); break;
#define | SET_STACK_END SET_MACHINE_STACK_END(&ec->machine.stack_end)
#define | STACK_START (ec->machine.stack_start)
#define | STACK_END (ec->machine.stack_end)
#define | STACK_LEVEL_MAX (ec->machine.stack_maxsize/sizeof(VALUE))
#define | STACK_LENGTH
#define | PREVENT_STACK_OVERFLOW 1
#define | stack_check(ec, water_mark) FALSE
#define | STACKFRAME_FOR_CALL_CFUNC 2048
#define | GET_STACK_BOUNDS(start, end, appendix)
#define | MARK_CHECKPOINT_PRINT_TICK(category)
#define | MARK_CHECKPOINT(category)
#define | PROFILE_REMEMBERSET_MARK 0
#define | gc_writebarrier_incremental(a, b, objspace)
#define | I(s) ID_##s = rb_intern(#s);
#define | MARK_OBJECT_ARY_BUCKET_SIZE 1024
#define | GC_NOTIFY 0
#define | gc_stress_full_mark_after_malloc_p() (FIXNUM_P(ruby_gc_stress_mode) && (FIX2LONG(ruby_gc_stress_mode) & (1<<gc_stress_full_mark_after_malloc)))
#define | global_symbols ruby_global_symbols
#define | S(s) sym_##s = ID2SYM(rb_intern_const(#s))
#define | SET(name, attr)
#define | S(s) gc_stat_symbols[gc_stat_sym_##s] = ID2SYM(rb_intern_const(#s))
#define | SET(name, attr)
#define | TRY_WITH_GC(siz, alloc)
#define | WMAP_DELETE_DEAD_OBJECT_IN_MARK 0
#define | GC_PROFILE_RECORD_DEFAULT_SIZE 100
#define | RUBY_DTRACE_GC_HOOK(name) do {if (RUBY_DTRACE_GC_##name##_ENABLED()) RUBY_DTRACE_GC_##name();} while (0)
#define | TYPE_NAME(t) case (t): return #t;
#define | ARY_SHARED_P(ary)
#define | ARY_EMBED_P(ary)
#define | BUFF_ARGS buff + pos, buff_size - pos
#define | APPENDF(f) if ((pos += snprintf f) >= buff_size) goto end
#define | TF(c) ((c) != 0 ? "true" : "false")
#define | C(c, s) ((c) != 0 ? (s) : " ")
#define | OPT(o) if (o) rb_ary_push(opts, rb_fstring_lit(#o))

## Typedefs
typedef struct gc_profile_record | gc_profile_record
typedef struct RVALUE | RVALUE
typedef uintptr_t | bits_t
typedef struct stack_chunk | stack_chunk_t
typedef struct mark_stack | mark_stack_t
typedef struct rb_heap_struct | rb_heap_t
typedef struct rb_objspace | rb_objspace_t
typedef int | each_obj_callback(void *, void *, size_t, void *)

## Enumerations
enum | gc_profile_record_flag { GPR_FLAG_NONE = 0x000 , GPR_FLAG_MAJOR_BY_NOFREE = 0x001 , GPR_FLAG_MAJOR_BY_OLDGEN = 0x002 , GPR_FLAG_MAJOR_BY_SHADY = 0x004 , GPR_FLAG_MAJOR_BY_FORCE = 0x008 , GPR_FLAG_MAJOR_MASK = 0x0ff , GPR_FLAG_NEWOBJ = 0x100 , GPR_FLAG_MALLOC = 0x200 , GPR_FLAG_METHOD = 0x400 , GPR_FLAG_CAPI = 0x800 , GPR_FLAG_STRESS = 0x1000 , GPR_FLAG_IMMEDIATE_SWEEP = 0x2000 , GPR_FLAG_HAVE_FINALIZE = 0x4000 , GPR_FLAG_IMMEDIATE_MARK = 0x8000 , GPR_FLAG_FULL_MARK = 0x10000 , GPR_FLAG_COMPACT = 0x20000 , GPR_DEFAULT_REASON }
enum | { BITS_SIZE = sizeof(bits_t) , BITS_BITLENGTH = ( BITS_SIZE * CHAR_BIT ) }
enum | gc_mode { gc_mode_none , gc_mode_marking , gc_mode_sweeping }
enum | { HEAP_PAGE_ALIGN = (1UL << HEAP_PAGE_ALIGN_LOG) , HEAP_PAGE_ALIGN_MASK = (~(~0UL << HEAP_PAGE_ALIGN_LOG)) , HEAP_PAGE_SIZE = HEAP_PAGE_ALIGN , HEAP_PAGE_OBJ_LIMIT = (unsigned int)((HEAP_PAGE_SIZE - sizeof(struct heap_page_header))/sizeof(struct RVALUE)) , HEAP_PAGE_BITMAP_LIMIT = CEILDIV(CEILDIV(HEAP_PAGE_SIZE, sizeof(struct RVALUE)), BITS_BITLENGTH) , HEAP_PAGE_BITMAP_SIZE = (BITS_SIZE * HEAP_PAGE_BITMAP_LIMIT) , HEAP_PAGE_BITMAP_PLANES = 4 }
enum | gc_enter_event { gc_enter_event_start , gc_enter_event_mark_continue , gc_enter_event_sweep_continue , gc_enter_event_rest , gc_enter_event_finalizer , gc_enter_event_rb_memerror }
enum | { gc_stress_no_major , gc_stress_no_immediate_sweep , gc_stress_full_mark_after_malloc , gc_stress_max }
enum | gc_stat_sym { gc_stat_sym_count , gc_stat_sym_heap_allocated_pages , gc_stat_sym_heap_sorted_length , gc_stat_sym_heap_allocatable_pages , gc_stat_sym_heap_available_slots , gc_stat_sym_heap_live_slots , gc_stat_sym_heap_free_slots , gc_stat_sym_heap_final_slots , gc_stat_sym_heap_marked_slots , gc_stat_sym_heap_eden_pages , gc_stat_sym_heap_tomb_pages , gc_stat_sym_total_allocated_pages , gc_stat_sym_total_freed_pages , gc_stat_sym_total_allocated_objects , gc_stat_sym_total_freed_objects , gc_stat_sym_malloc_increase_bytes , gc_stat_sym_malloc_increase_bytes_limit , gc_stat_sym_minor_gc_count , gc_stat_sym_major_gc_count , gc_stat_sym_compact_count , gc_stat_sym_read_barrier_faults , gc_stat_sym_total_moved_objects , gc_stat_sym_remembered_wb_unprotected_objects , gc_stat_sym_remembered_wb_unprotected_objects_limit , gc_stat_sym_old_objects , gc_stat_sym_old_objects_limit , gc_stat_sym_last }
enum | memop_type { MEMOP_TYPE_MALLOC = 0 , MEMOP_TYPE_FREE , MEMOP_TYPE_REALLOC }

## Functions
size_t | rb_size_mul_or_raise (size_t x, size_t y, VALUE exc)
size_t | rb_size_mul_add_or_raise (size_t x, size_t y, size_t z, VALUE exc)
void | rb_iseq_mark (const rb_iseq_t *iseq)
void | rb_iseq_update_references (rb_iseq_t *iseq)
void | rb_iseq_free (const rb_iseq_t *iseq)
size_t | rb_iseq_memsize (const rb_iseq_t *iseq)
void | rb_vm_update_references (void *ptr)
void | rb_gcdebug_print_obj_condition (VALUE obj)
| NO_SANITIZE ("memory", static void gc_mark_maybe(rb_objspace_t *objspace, VALUE ptr))
| NO_SANITIZE ("memory", static inline int is_pointer_to_heap(rb_objspace_t *objspace, void *ptr))
rb_objspace_t * | rb_objspace_alloc (void)
void | rb_objspace_free (rb_objspace_t *objspace)
void | rb_objspace_set_event_hook (const rb_event_flag_t event)
VALUE | rb_wb_unprotected_newobj_of (VALUE klass, VALUE flags)
VALUE | rb_wb_protected_newobj_of (VALUE klass, VALUE flags)
VALUE | rb_ec_wb_protected_newobj_of (rb_execution_context_t *ec, VALUE klass, VALUE flags)
VALUE | rb_newobj (void)
VALUE | rb_newobj_of (VALUE klass, VALUE flags)
const char * | rb_imemo_name (enum imemo_type type)
VALUE | rb_imemo_new (enum imemo_type type, VALUE v1, VALUE v2, VALUE v3, VALUE v0)
rb_imemo_tmpbuf_t * | rb_imemo_tmpbuf_parser_heap (void *buf, rb_imemo_tmpbuf_t *old_heap, size_t cnt)
VALUE | rb_class_allocate_instance (VALUE klass)
VALUE | rb_data_object_wrap (VALUE klass, void *datap, RUBY_DATA_FUNC dmark, RUBY_DATA_FUNC dfree)
VALUE | rb_data_object_zalloc (VALUE klass, size_t size, RUBY_DATA_FUNC dmark, RUBY_DATA_FUNC dfree)
VALUE | rb_data_typed_object_wrap (VALUE klass, void *datap, const rb_data_type_t *type)
VALUE | rb_data_typed_object_zalloc (VALUE klass, size_t size, const rb_data_type_t *type)
size_t | rb_objspace_data_type_memsize (VALUE obj)
const char * | rb_objspace_data_type_name (VALUE obj)
void | rb_free_const_table (struct rb_id_table *tbl)
void | rb_vm_ccs_free (struct rb_class_cc_entries *ccs)
void | rb_cc_table_free (VALUE klass)
void | Init_heap (void)
void | Init_gc_stress (void)
void | rb_objspace_each_objects (each_obj_callback *callback, void *data)
void | rb_objspace_each_objects_without_setup (each_obj_callback *callback, void *data)
int | rb_objspace_internal_object_p (VALUE obj)
VALUE | rb_undefine_finalizer (VALUE obj)
VALUE | rb_define_finalizer (VALUE obj, VALUE block)
void | rb_gc_copy_finalizer (VALUE dest, VALUE obj)
bool | rb_obj_is_main_ractor (VALUE gv)
void | rb_objspace_call_finalizer (rb_objspace_t *objspace)
int | rb_objspace_markable_object_p (VALUE obj)
int | rb_objspace_garbage_object_p (VALUE obj)
VALUE | rb_memory_id (VALUE obj)
VALUE | rb_obj_id (VALUE obj)
size_t | rb_obj_memsize_of (VALUE obj)
int | ruby_get_stack_grow_direction (volatile VALUE *addr)
size_t | ruby_stack_length (VALUE **p)
int | rb_ec_stack_check (rb_execution_context_t *ec)
int | ruby_stack_check (void)
| ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS (static void mark_locations_array(rb_objspace_t *objspace, register const VALUE *x, register long n))
void | rb_gc_mark_locations (const VALUE *start, const VALUE *end)
void | rb_gc_mark_values (long n, const VALUE *values)
void | rb_gc_mark_vm_stack_values (long n, const VALUE *values)
void | rb_mark_set (st_table *tbl)
void | rb_mark_hash (st_table *tbl)
void | rb_gc_mark_machine_stack (const rb_execution_context_t *ec)
void | rb_mark_tbl (st_table *tbl)
void | rb_mark_tbl_no_pin (st_table *tbl)
void | rb_gc_mark_maybe (VALUE obj)
void | rb_gc_mark_movable (VALUE ptr)
void | rb_gc_mark (VALUE ptr)
int | rb_objspace_marked_object_p (VALUE obj)
void | rb_gc_verify_internal_consistency (void)
void | rb_gc_writebarrier (VALUE a, VALUE b)
void | rb_gc_writebarrier_unprotect (VALUE obj)
void | rb_gc_writebarrier_remember (VALUE obj)
void | rb_gc_unprotect_logging (void *objptr, const char *filename, int line)
void | rb_copy_wb_protected_attribute (VALUE dest, VALUE obj)
VALUE | rb_obj_rgengc_writebarrier_protected_p (VALUE obj)
VALUE | rb_obj_rgengc_promoted_p (VALUE obj)
size_t | rb_obj_gc_flags (VALUE obj, ID *flags, size_t max)
void | rb_gc_ractor_newobj_cache_clear (rb_ractor_newobj_cache_t *newobj_cache)
void | rb_gc_force_recycle (VALUE obj)
void | rb_gc_register_mark_object (VALUE obj)
| Inform the garbage collector that `object` is a live Ruby object that should not be moved. More...
void | rb_gc_register_address (VALUE *addr)
| Inform the garbage collector that `valptr` points to a live Ruby object that should not be moved. More...
void | rb_gc_unregister_address (VALUE *addr)
| 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_global_variable (VALUE *var)
| An alias for `rb_gc_register_address()`. More...
void | rb_gc_update_tbl_refs (st_table *ptr)
VALUE | rb_gc_location (VALUE value)
VALUE | rb_gc_start (void)
void | rb_gc (void)
int | rb_during_gc (void)
size_t | rb_gc_count (void)
VALUE | rb_gc_latest_gc_info (VALUE key)
size_t | rb_gc_stat (VALUE key)
VALUE | rb_gc_enable (void)
VALUE | rb_objspace_gc_enable (rb_objspace_t *objspace)
VALUE | rb_gc_disable_no_rest (void)
VALUE | rb_gc_disable (void)
VALUE | rb_objspace_gc_disable (rb_objspace_t *objspace)
void | ruby_gc_set_params (void)
void | rb_objspace_reachable_objects_from (VALUE obj, void(func)(VALUE, void *), void *data)
void | rb_objspace_reachable_objects_from_root (void(func)(const char *category, VALUE, void *), void *passing_data)
void | rb_memerror (void)
void * | rb_aligned_malloc (size_t alignment, size_t size)
void | rb_malloc_info_show_results (void)
void * | ruby_xmalloc_body (size_t size)
void | ruby_malloc_size_overflow (size_t count, size_t elsize)
void * | ruby_xmalloc2_body (size_t n, size_t size)
void * | ruby_xcalloc_body (size_t n, size_t size)
void * | ruby_sized_xrealloc (void *ptr, size_t new_size, size_t old_size)
void * | ruby_xrealloc_body (void *ptr, size_t new_size)
void * | ruby_sized_xrealloc2 (void *ptr, size_t n, size_t size, size_t old_n)
void * | ruby_xrealloc2_body (void *ptr, size_t n, size_t size)
void | ruby_sized_xfree (void *x, size_t size)
void | ruby_xfree (void *x)
| Deallocates a storage instance. More...
void * | rb_xmalloc_mul_add (size_t x, size_t y, size_t z)
void * | rb_xrealloc_mul_add (const void *p, size_t x, size_t y, size_t z)
void * | rb_xmalloc_mul_add_mul (size_t x, size_t y, size_t z, size_t w)
void * | rb_xcalloc_mul_add_mul (size_t x, size_t y, size_t z, size_t w)
void * | ruby_mimmalloc (size_t size)
void | ruby_mimfree (void *ptr)
void * | rb_alloc_tmp_buffer_with_count (volatile VALUE *store, size_t size, size_t cnt)
void * | rb_alloc_tmp_buffer (volatile VALUE *store, long len)
void | rb_free_tmp_buffer (volatile VALUE *store)
void | rb_gc_adjust_memory_usage (ssize_t diff)
const char * | rb_method_type_name (rb_method_type_t type)
bool | rb_ractor_p (VALUE rv)
const char * | rb_raw_obj_info (char *buff, const int buff_size, VALUE obj)
const char * | rb_obj_info (VALUE obj)
void | rb_obj_info_dump (VALUE obj)
void | rb_obj_info_dump_loc (VALUE obj, const char *file, int line, const char *func)
void | Init_GC (void)
void * | ruby_xmalloc (size_t size)
| Allocates a storage instance. More...
void * | ruby_xmalloc2 (size_t n, size_t size)
| Identical to ruby_xmalloc(), except it allocates `nelems` * `elemsiz` bytes. More...
void * | ruby_xcalloc (size_t n, size_t size)
| Identical to ruby_xmalloc2(), except it zero-fills the region before it returns. More...
void * | ruby_xrealloc (void *ptr, size_t new_size)
| Resize the storage instance. More...
void * | ruby_xrealloc2 (void *ptr, size_t n, size_t new_size)
| Identical to ruby_xrealloc(), except it resizes the given storage instance to `newelems` * `newsiz` bytes. More...

## Variables
int | ruby_rgengc_debug
VALUE * | ruby_initial_gc_stress_ptr = &ruby_initial_gc_stress
VALUE | rb_mGC
int | ruby_disable_gc = 0
int | ruby_enable_autocompact = 0
int | ruby_stack_grow_direction
rb_symbols_t | ruby_global_symbols

## Macro Definition Documentation

## ◆ APPENDF

#define APPENDF | ( |  | f | ) | if ((pos += snprintf f) >= buff_size) goto end

## ◆ ARY_EMBED_P

#define ARY_EMBED_P | ( |  | ary | ) |

Value:
(GC_ASSERT(!FL_TEST((ary), ELTS_SHARED) || !FL_TEST((ary), RARRAY_EMBED_FLAG)), \
FL_TEST((ary), RARRAY_EMBED_FLAG)!=0)
ELTS_SHARED
#define ELTS_SHARED
Definition: fl_type.h:84
GC_ASSERT
#define GC_ASSERT(expr)
Definition: gc.c:398
FL_TEST
#define FL_TEST
Definition: fl_type.h:130
RARRAY_EMBED_FLAG
#define RARRAY_EMBED_FLAG
Definition: rarray.h:43

Definition at line 12200 of file gc.c.

## ◆ ARY_SHARED_P

#define ARY_SHARED_P | ( |  | ary | ) |

Value:
(GC_ASSERT(!FL_TEST((ary), ELTS_SHARED) || !FL_TEST((ary), RARRAY_EMBED_FLAG)), \
FL_TEST((ary),ELTS_SHARED)!=0)

Definition at line 12197 of file gc.c.

## ◆ BITMAP_BIT

#define BITMAP_BIT | ( |  | p | ) | ((bits_t)1 << BITMAP_OFFSET(p))

Definition at line 859 of file gc.c.

## ◆ BITMAP_INDEX

#define BITMAP_INDEX | ( |  | p | ) | (NUM_IN_PAGE(p) / BITS_BITLENGTH )

Definition at line 857 of file gc.c.

## ◆ BITMAP_OFFSET

#define BITMAP_OFFSET | ( |  | p | ) | (NUM_IN_PAGE(p) & (BITS_BITLENGTH-1))

Definition at line 858 of file gc.c.

## ◆ BUFF_ARGS

#define BUFF_ARGS buff + pos, buff_size - pos

## ◆ C

#define C | ( |  | c,
|  |  | s
| ) |  | ((c) != 0 ? (s) : " ")

## ◆ CALC_EXACT_MALLOC_SIZE

#define CALC_EXACT_MALLOC_SIZE USE_GC_MALLOC_OBJ_INFO_DETAILS

Definition at line 449 of file gc.c.

## ◆ CEILDIV

#define CEILDIV | ( |  | i,
|  |  | mod
| ) |  | (((i) + (mod) - 1)/(mod))

Definition at line 814 of file gc.c.

## ◆ CLEAR_IN_BITMAP

#define CLEAR_IN_BITMAP | ( |  | bits,
|  |  | p
| ) |  | ((bits)[BITMAP_INDEX(p)] = (bits)[BITMAP_INDEX(p)] & ~BITMAP_BIT(p))

Definition at line 864 of file gc.c.

## ◆ COUNT_TYPE

#define COUNT_TYPE | ( |  | t | ) | case (t): return ID2SYM(rb_intern(#t)); break;

## ◆ dont_gc_off

#define dont_gc_off | ( |  | ) | (objspace->flags.dont_gc = 0)

Definition at line 914 of file gc.c.

## ◆ dont_gc_on

#define dont_gc_on | ( |  | ) | (objspace->flags.dont_gc = 1)

Definition at line 913 of file gc.c.

## ◆ dont_gc_set

#define dont_gc_set | ( |  | b | ) | (((int)b), objspace->flags.dont_gc = (b))

Definition at line 915 of file gc.c.

## ◆ dont_gc_val

#define dont_gc_val | ( |  | ) | (objspace->flags.dont_gc)

Definition at line 916 of file gc.c.

## ◆ during_gc

#define during_gc objspace->flags.during_gc

Definition at line 895 of file gc.c.

## ◆ finalizer_table

#define finalizer_table objspace->finalizer_table

Definition at line 897 of file gc.c.

## ◆ finalizing

#define finalizing objspace->atomic_flags.finalizing

Definition at line 896 of file gc.c.

## ◆ FL_CHECK2

#define FL_CHECK2 | ( |  | name,
|  |  | x,
|  |  | pred
| ) |  |

Value:
((RGENGC_CHECK_MODE && SPECIAL_CONST_P(x)) ? \
(rb_bug(name": SPECIAL_CONST (%p)", (void *)(x)), 0) : (pred))
RGENGC_CHECK_MODE
#define RGENGC_CHECK_MODE
Definition: gc.c:394
rb_bug
void rb_bug(const char *fmt,...)
Definition: error.c:768
name
const char * name
Definition: nkf.c:208
SPECIAL_CONST_P
#define SPECIAL_CONST_P
Definition: special_consts.h:47

Definition at line 1213 of file gc.c.

## ◆ FL_FROM_FREELIST

#define FL_FROM_FREELIST FL_USER0

Definition at line 543 of file gc.c.

## ◆ FL_SET2

#define FL_SET2 | ( |  | x,
|  |  | f
| ) |  | FL_CHECK2("FL_SET2", x, RBASIC(x)->flags |= (f))

Definition at line 1217 of file gc.c.

## ◆ FL_TEST2

#define FL_TEST2 | ( |  | x,
|  |  | f
| ) |  | FL_CHECK2("FL_TEST2", x, FL_TEST_RAW((x),(f)) != 0)

Definition at line 1216 of file gc.c.

## ◆ FL_UNSET2

#define FL_UNSET2 | ( |  | x,
|  |  | f
| ) |  | FL_CHECK2("FL_UNSET2", x, RBASIC(x)->flags &= ~(f))

Definition at line 1218 of file gc.c.

## ◆ GC_ASSERT

#define GC_ASSERT | ( |  | expr | ) | RUBY_ASSERT_MESG_WHEN(RGENGC_CHECK_MODE > 0, expr, #expr)

Definition at line 398 of file gc.c.

## ◆ GC_DEBUG

#define GC_DEBUG 0

Definition at line 361 of file gc.c.

## ◆ GC_DEBUG_STRESS_TO_CLASS

#define GC_DEBUG_STRESS_TO_CLASS 0

Definition at line 463 of file gc.c.

## ◆ GC_ENABLE_INCREMENTAL_MARK

#define GC_ENABLE_INCREMENTAL_MARK USE_RINCGC

Definition at line 443 of file gc.c.

## ◆ GC_ENABLE_LAZY_SWEEP

#define GC_ENABLE_LAZY_SWEEP 1

Definition at line 446 of file gc.c.

## ◆ gc_event_hook

#define gc_event_hook | ( |  | objspace,
|  |  | event,
|  |  | data
| ) |  | gc_event_hook_prep(objspace, event, data, (void)0)

Definition at line 2081 of file gc.c.

## ◆ gc_event_hook_available_p

#define gc_event_hook_available_p | ( |  | objspace | ) | ((objspace)->flags.has_hook)

Definition at line 2071 of file gc.c.

## ◆ gc_event_hook_needed_p

#define gc_event_hook_needed_p | ( |  | objspace,
|  |  | event
| ) |  | ((objspace)->hook_events & (event))

Definition at line 2072 of file gc.c.

## ◆ gc_event_hook_prep

#define gc_event_hook_prep | ( |  | objspace,
|  |  | event,
|  |  | data,
|  |  | prep
| ) |  |

Value:
do { \
if (UNLIKELY(gc_event_hook_needed_p(objspace, event))) { \
prep; \
gc_event_hook_body(GET_EC(), (objspace), (event), (data)); \
} \
} while (0)
UNLIKELY
#define UNLIKELY(x)
Definition: ffi_common.h:126
gc_event_hook_needed_p
#define gc_event_hook_needed_p(objspace, event)
Definition: gc.c:2072

Definition at line 2074 of file gc.c.

## ◆ GC_HEAP_FREE_SLOTS

#define GC_HEAP_FREE_SLOTS 4096

Definition at line 258 of file gc.c.

## ◆ GC_HEAP_FREE_SLOTS_GOAL_RATIO

#define GC_HEAP_FREE_SLOTS_GOAL_RATIO 0.40

Definition at line 274 of file gc.c.

## ◆ GC_HEAP_FREE_SLOTS_MAX_RATIO

#define GC_HEAP_FREE_SLOTS_MAX_RATIO 0.65

Definition at line 277 of file gc.c.

## ◆ GC_HEAP_FREE_SLOTS_MIN_RATIO

#define GC_HEAP_FREE_SLOTS_MIN_RATIO 0.20

Definition at line 271 of file gc.c.

## ◆ GC_HEAP_GROWTH_FACTOR

#define GC_HEAP_GROWTH_FACTOR 1.8

Definition at line 261 of file gc.c.

## ◆ GC_HEAP_GROWTH_MAX_SLOTS

#define GC_HEAP_GROWTH_MAX_SLOTS 0 /* 0 is disable */

Definition at line 264 of file gc.c.

## ◆ GC_HEAP_INIT_SLOTS

#define GC_HEAP_INIT_SLOTS 10000

Definition at line 255 of file gc.c.

## ◆ GC_HEAP_OLDOBJECT_LIMIT_FACTOR

#define GC_HEAP_OLDOBJECT_LIMIT_FACTOR 2.0

Definition at line 267 of file gc.c.

## ◆ GC_MALLOC_LIMIT_GROWTH_FACTOR

#define GC_MALLOC_LIMIT_GROWTH_FACTOR 1.4

Definition at line 287 of file gc.c.

## ◆ GC_MALLOC_LIMIT_MAX

#define GC_MALLOC_LIMIT_MAX (32 * 1024 * 1024 /* 32MB */)

Definition at line 284 of file gc.c.

## ◆ GC_MALLOC_LIMIT_MIN

#define GC_MALLOC_LIMIT_MIN (16 * 1024 * 1024 /* 16MB */)

Definition at line 281 of file gc.c.

## ◆ gc_mode

#define gc_mode | ( |  | objspace | ) | gc_mode_verify((enum gc_mode)(objspace)->flags.mode)

Definition at line 935 of file gc.c.

## ◆ gc_mode_set

#define gc_mode_set | ( |  | objspace,
|  |  | mode
| ) |  | ((objspace)->flags.mode = (unsigned int)gc_mode_verify(mode))

Definition at line 936 of file gc.c.

## ◆ GC_NOTIFY

#define GC_NOTIFY 0

Definition at line 8080 of file gc.c.

## ◆ GC_OLDMALLOC_LIMIT_GROWTH_FACTOR

#define GC_OLDMALLOC_LIMIT_GROWTH_FACTOR 1.2

Definition at line 294 of file gc.c.

## ◆ GC_OLDMALLOC_LIMIT_MAX

#define GC_OLDMALLOC_LIMIT_MAX (128 * 1024 * 1024 /* 128MB */)

Definition at line 297 of file gc.c.

## ◆ GC_OLDMALLOC_LIMIT_MIN

#define GC_OLDMALLOC_LIMIT_MIN (16 * 1024 * 1024 /* 16MB */)

Definition at line 291 of file gc.c.

## ◆ gc_prof_enabled

#define gc_prof_enabled | ( |  | objspace | ) | ((objspace)->profile.run && (objspace)->profile.current_record)

Definition at line 1081 of file gc.c.

## ◆ gc_prof_record

#define gc_prof_record | ( |  | objspace | ) | (objspace)->profile.current_record

Definition at line 1080 of file gc.c.

## ◆ GC_PROFILE_DETAIL_MEMORY

#define GC_PROFILE_DETAIL_MEMORY 0

Definition at line 440 of file gc.c.

## ◆ GC_PROFILE_MORE_DETAIL

#define GC_PROFILE_MORE_DETAIL 0

Definition at line 437 of file gc.c.

## ◆ GC_PROFILE_RECORD_DEFAULT_SIZE

#define GC_PROFILE_RECORD_DEFAULT_SIZE 100

Definition at line 11528 of file gc.c.

## ◆ gc_report

#define gc_report | ( |  | level,
|  |  | objspace,
|  |  | ...
| ) |  | if (!RGENGC_DEBUG_ENABLED(level)) {} else gc_report_body(level, objspace, __VA_ARGS__)

Definition at line 1084 of file gc.c.

## ◆ gc_stress_full_mark_after_malloc_p

#define gc_stress_full_mark_after_malloc_p | ( |  | ) | (FIXNUM_P(ruby_gc_stress_mode) && (FIX2LONG(ruby_gc_stress_mode) & (1<<gc_stress_full_mark_after_malloc)))

Definition at line 8089 of file gc.c.

## ◆ gc_writebarrier_incremental

#define gc_writebarrier_incremental | ( |  | a,
|  |  | b,
|  |  | objspace
| ) |  |

Definition at line 7746 of file gc.c.

## ◆ GET_HEAP_MARK_BITS

#define GET_HEAP_MARK_BITS | ( |  | x | ) | (&GET_HEAP_PAGE(x)->mark_bits[0])

Definition at line 867 of file gc.c.

## ◆ GET_HEAP_MARKING_BITS

#define GET_HEAP_MARKING_BITS | ( |  | x | ) | (&GET_HEAP_PAGE(x)->marking_bits[0])

Definition at line 871 of file gc.c.

## ◆ GET_HEAP_PAGE

#define GET_HEAP_PAGE | ( |  | x | ) | (GET_PAGE_HEADER(x)->page)

Definition at line 854 of file gc.c.

## ◆ GET_HEAP_PINNED_BITS

#define GET_HEAP_PINNED_BITS | ( |  | x | ) | (&GET_HEAP_PAGE(x)->pinned_bits[0])

Definition at line 868 of file gc.c.

## ◆ GET_HEAP_UNCOLLECTIBLE_BITS

#define GET_HEAP_UNCOLLECTIBLE_BITS | ( |  | x | ) | (&GET_HEAP_PAGE(x)->uncollectible_bits[0])

Definition at line 869 of file gc.c.

## ◆ GET_HEAP_WB_UNPROTECTED_BITS

#define GET_HEAP_WB_UNPROTECTED_BITS | ( |  | x | ) | (&GET_HEAP_PAGE(x)->wb_unprotected_bits[0])

Definition at line 870 of file gc.c.

## ◆ GET_PAGE_BODY

#define GET_PAGE_BODY | ( |  | x | ) | ((struct heap_page_body *)((bits_t)(x) & ~(HEAP_PAGE_ALIGN_MASK)))

Definition at line 852 of file gc.c.

## ◆ GET_PAGE_HEADER

#define GET_PAGE_HEADER | ( |  | x | ) | (&GET_PAGE_BODY(x)->header)

Definition at line 853 of file gc.c.

## ◆ GET_STACK_BOUNDS

#define GET_STACK_BOUNDS | ( |  | start,
|  |  | end,
|  |  | appendix
| ) |  |

Value:
((STACK_END < STACK_START) ? \
((start) = STACK_END, (end) = STACK_START) : ((start) = STACK_START, (end) = STACK_END+(appendix)))
STACK_END
#define STACK_END
Definition: gc.c:5482
STACK_START
#define STACK_START
Definition: gc.c:5481

Definition at line 5835 of file gc.c.

## ◆ global_list

#define global_list objspace->global_list

Definition at line 898 of file gc.c.

## ◆ global_symbols

#define global_symbols ruby_global_symbols

Definition at line 9343 of file gc.c.

## ◆ has_sweeping_pages

#define has_sweeping_pages | ( |  | heap | ) | ((heap)->sweeping_page != 0)

Definition at line 951 of file gc.c.

## ◆ heap_allocatable_pages

#define heap_allocatable_pages objspace->heap_pages.allocatable_pages

Definition at line 889 of file gc.c.

## ◆ heap_allocated_pages

#define heap_allocated_pages objspace->heap_pages.allocated_pages

Definition at line 885 of file gc.c.

## ◆ heap_eden

#define heap_eden (&objspace->eden_heap)

Definition at line 893 of file gc.c.

## ◆ HEAP_PAGE_ALIGN_LOG

#define HEAP_PAGE_ALIGN_LOG 14

Definition at line 813 of file gc.c.

## ◆ heap_pages_deferred_final

#define heap_pages_deferred_final objspace->heap_pages.deferred_final

Definition at line 892 of file gc.c.

## ◆ heap_pages_final_slots

#define heap_pages_final_slots objspace->heap_pages.final_slots

Definition at line 891 of file gc.c.

## ◆ heap_pages_freeable_pages

#define heap_pages_freeable_pages objspace->heap_pages.freeable_pages

Definition at line 890 of file gc.c.

## ◆ heap_pages_himem

#define heap_pages_himem objspace->heap_pages.range[1]

Definition at line 888 of file gc.c.

## ◆ heap_pages_lomem

#define heap_pages_lomem objspace->heap_pages.range[0]

Definition at line 887 of file gc.c.

## ◆ heap_pages_sorted

#define heap_pages_sorted objspace->heap_pages.sorted

Definition at line 884 of file gc.c.

## ◆ heap_pages_sorted_length

#define heap_pages_sorted_length objspace->heap_pages.sorted_length

Definition at line 886 of file gc.c.

## ◆ heap_tomb

#define heap_tomb (&objspace->tomb_heap)

Definition at line 894 of file gc.c.

## ◆ I

#define I | ( |  | s | ) | ID_##s = rb_intern(#s);

## ◆ IMEMO_NAME

#define IMEMO_NAME | ( |  | x | ) | case imemo_##x: return #x;

## ◆ is_full_marking

#define is_full_marking | ( |  | objspace | ) | ((objspace)->flags.during_minor_gc == FALSE)

Definition at line 940 of file gc.c.

## ◆ is_incremental_marking

#define is_incremental_marking | ( |  | objspace | ) | FALSE

Definition at line 944 of file gc.c.

## ◆ is_lazy_sweeping

#define is_lazy_sweeping | ( |  | heap | ) | (GC_ENABLE_LAZY_SWEEP && has_sweeping_pages(heap))

Definition at line 952 of file gc.c.

## ◆ is_marking

#define is_marking | ( |  | objspace | ) | (gc_mode(objspace) == gc_mode_marking)

Definition at line 938 of file gc.c.

## ◆ is_sweeping

#define is_sweeping | ( |  | objspace | ) | (gc_mode(objspace) == gc_mode_sweeping)

Definition at line 939 of file gc.c.

## ◆ MALLOC_ALLOCATED_SIZE

#define MALLOC_ALLOCATED_SIZE 0

Definition at line 456 of file gc.c.

## ◆ malloc_allocated_size

#define malloc_allocated_size objspace->malloc_params.allocated_size

Definition at line 883 of file gc.c.

## ◆ MALLOC_ALLOCATED_SIZE_CHECK

#define MALLOC_ALLOCATED_SIZE_CHECK 0

Definition at line 459 of file gc.c.

## ◆ malloc_increase

#define malloc_increase objspace->malloc_params.increase

Definition at line 882 of file gc.c.

## ◆ malloc_limit

#define malloc_limit objspace->malloc_params.limit

Definition at line 881 of file gc.c.

## ◆ MARK_CHECKPOINT

#define MARK_CHECKPOINT | ( |  | category | ) |

Value:
do { \
if (categoryp) *categoryp = category; \
MARK_CHECKPOINT_PRINT_TICK(category); \
} while (0)

## ◆ MARK_CHECKPOINT_PRINT_TICK

#define MARK_CHECKPOINT_PRINT_TICK | ( |  | category | ) |

## ◆ MARK_IN_BITMAP

#define MARK_IN_BITMAP | ( |  | bits,
|  |  | p
| ) |  | ((bits)[BITMAP_INDEX(p)] = (bits)[BITMAP_INDEX(p)] | BITMAP_BIT(p))

Definition at line 863 of file gc.c.

## ◆ MARK_OBJECT_ARY_BUCKET_SIZE

#define MARK_OBJECT_ARY_BUCKET_SIZE 1024

Definition at line 8018 of file gc.c.

## ◆ MARKED_IN_BITMAP

#define MARKED_IN_BITMAP | ( |  | bits,
|  |  | p
| ) |  | ((bits)[BITMAP_INDEX(p)] & BITMAP_BIT(p))

Definition at line 862 of file gc.c.

## ◆ MEASURE_LINE

#define MEASURE_LINE | ( |  | expr | ) | expr

Definition at line 1202 of file gc.c.

## ◆ nomem_error

#define nomem_error GET_VM()->special_exceptions[ruby_error_nomemory]

Definition at line 976 of file gc.c.

## ◆ nonspecial_obj_id

#define nonspecial_obj_id | ( |  | obj | ) | (VALUE)((SIGNED_VALUE)(obj)|FIXNUM_FLAG)

Definition at line 955 of file gc.c.

## ◆ NUM2PTR

#define NUM2PTR | ( |  | x | ) | NUM2ULONG(x)

## ◆ NUM_IN_PAGE

#define NUM_IN_PAGE | ( |  | p | ) | (((bits_t)(p) & HEAP_PAGE_ALIGN_MASK)/sizeof(RVALUE))

Definition at line 856 of file gc.c.

## ◆ OBJ_ID_INCREMENT

#define OBJ_ID_INCREMENT (sizeof(RVALUE) / 2)

Definition at line 3130 of file gc.c.

## ◆ OBJ_ID_INITIAL

#define OBJ_ID_INITIAL (OBJ_ID_INCREMENT * 2)

Definition at line 3131 of file gc.c.

## ◆ obj_id_to_ref

#define obj_id_to_ref | ( |  | objid | ) | ((objid) ^ FIXNUM_FLAG) /* unset FIXNUM_FLAG */

Definition at line 956 of file gc.c.

## ◆ OPT

#define OPT | ( |  | o | ) | if (o) rb_ary_push(opts, rb_fstring_lit(#o))

## ◆ popcount_bits

#define popcount_bits rb_popcount_intptr

Definition at line 614 of file gc.c.

## ◆ PREVENT_STACK_OVERFLOW

#define PREVENT_STACK_OVERFLOW 1

Definition at line 5520 of file gc.c.

## ◆ PRINT_ENTER_EXIT_TICK

#define PRINT_ENTER_EXIT_TICK 0

Definition at line 304 of file gc.c.

## ◆ PRINT_MEASURE_LINE

#define PRINT_MEASURE_LINE 0

Definition at line 301 of file gc.c.

## ◆ PRINT_ROOT_TICKS

#define PRINT_ROOT_TICKS 0

Definition at line 307 of file gc.c.

## ◆ PROFILE_REMEMBERSET_MARK

#define PROFILE_REMEMBERSET_MARK 0

Definition at line 7578 of file gc.c.

## ◆ RANY

#define RANY | ( |  | o | ) | ((RVALUE*)(o))

Definition at line 965 of file gc.c.

## ◆ rb_data_object_alloc

#define rb_data_object_alloc rb_data_object_alloc

Definition at line 14 of file gc.c.

## ◆ rb_data_typed_object_alloc

#define rb_data_typed_object_alloc rb_data_typed_object_alloc

Definition at line 15 of file gc.c.

## ◆ rb_jmp_buf

#define rb_jmp_buf rb_jmpbuf_t

Definition at line 120 of file gc.c.

## ◆ rb_objspace

#define rb_objspace (*rb_objspace_of(GET_VM()))

Definition at line 874 of file gc.c.

## ◆ rb_objspace_of

#define rb_objspace_of | ( |  | vm | ) | ((vm)->objspace)

Definition at line 875 of file gc.c.

## ◆ rb_setjmp

#define rb_setjmp | ( |  | env | ) | RUBY_SETJMP(env)

Definition at line 119 of file gc.c.

## ◆ RESTORE_FINALIZER

#define RESTORE_FINALIZER | ( |  | ) |

Value:
(\
ec->cfp = saved.cfp, \
rb_set_errinfo(saved.errinfo))

## ◆ RGENGC_CHECK_MODE

#define RGENGC_CHECK_MODE 0

Definition at line 394 of file gc.c.

## ◆ RGENGC_DEBUG

#define RGENGC_DEBUG 0

Definition at line 375 of file gc.c.

## ◆ RGENGC_DEBUG_ENABLED

#define RGENGC_DEBUG_ENABLED | ( |  | level | ) | 0

Definition at line 381 of file gc.c.

## ◆ RGENGC_ESTIMATE_OLDMALLOC

#define RGENGC_ESTIMATE_OLDMALLOC 1

Definition at line 426 of file gc.c.

## ◆ RGENGC_FORCE_MAJOR_GC

#define RGENGC_FORCE_MAJOR_GC 0

Definition at line 433 of file gc.c.

## ◆ RGENGC_OBJ_INFO

#define RGENGC_OBJ_INFO (RGENGC_DEBUG | RGENGC_CHECK_MODE)

Definition at line 467 of file gc.c.

## ◆ RGENGC_OLD_NEWOBJ_CHECK

#define RGENGC_OLD_NEWOBJ_CHECK 0

Definition at line 407 of file gc.c.

## ◆ RGENGC_PROFILE

#define RGENGC_PROFILE 0

Definition at line 416 of file gc.c.

## ◆ RMOVED

#define RMOVED | ( |  | obj | ) | ((struct RMoved *)(obj))

Definition at line 551 of file gc.c.

## ◆ RUBY_DTRACE_GC_HOOK

#define RUBY_DTRACE_GC_HOOK | ( |  | name | ) | do {if (RUBY_DTRACE_GC_##name##_ENABLED()) RUBY_DTRACE_GC_##name();} while (0)

Definition at line 11667 of file gc.c.

## ◆ ruby_gc_stress_mode

#define ruby_gc_stress_mode objspace->gc_stress_mode

Definition at line 900 of file gc.c.

## ◆ ruby_gc_stressful

#define ruby_gc_stressful objspace->flags.gc_stressful

Definition at line 899 of file gc.c.

## ◆ ruby_initial_gc_stress

#define ruby_initial_gc_stress gc_params.gc_stress

Definition at line 877 of file gc.c.

## ◆ RVALUE_AGE_SHIFT

#define RVALUE_AGE_SHIFT 5 /* FL_PROMOTED0 bit */

Definition at line 1233 of file gc.c.

## ◆ RVALUE_MARK_BITMAP

#define RVALUE_MARK_BITMAP | ( |  | obj | ) | MARKED_IN_BITMAP(GET_HEAP_MARK_BITS(obj), (obj))

Definition at line 1220 of file gc.c.

## ◆ RVALUE_MARKING_BITMAP

#define RVALUE_MARKING_BITMAP | ( |  | obj | ) | MARKED_IN_BITMAP(GET_HEAP_MARKING_BITS(obj), (obj))

Definition at line 1226 of file gc.c.

## ◆ RVALUE_OLD_AGE

#define RVALUE_OLD_AGE 3

Definition at line 1232 of file gc.c.

## ◆ RVALUE_PAGE_MARKED

#define RVALUE_PAGE_MARKED | ( |  | page,
|  |  | obj
| ) |  | MARKED_IN_BITMAP((page)->mark_bits, (obj))

Definition at line 1222 of file gc.c.

## ◆ RVALUE_PAGE_MARKING

#define RVALUE_PAGE_MARKING | ( |  | page,
|  |  | obj
| ) |  | MARKED_IN_BITMAP((page)->marking_bits, (obj))

Definition at line 1230 of file gc.c.

## ◆ RVALUE_PAGE_UNCOLLECTIBLE

#define RVALUE_PAGE_UNCOLLECTIBLE | ( |  | page,
|  |  | obj
| ) |  | MARKED_IN_BITMAP((page)->uncollectible_bits, (obj))

Definition at line 1229 of file gc.c.

## ◆ RVALUE_PAGE_WB_UNPROTECTED

#define RVALUE_PAGE_WB_UNPROTECTED | ( |  | page,
|  |  | obj
| ) |  | MARKED_IN_BITMAP((page)->wb_unprotected_bits, (obj))

Definition at line 1228 of file gc.c.

## ◆ RVALUE_PIN_BITMAP

#define RVALUE_PIN_BITMAP | ( |  | obj | ) | MARKED_IN_BITMAP(GET_HEAP_PINNED_BITS(obj), (obj))

Definition at line 1221 of file gc.c.

## ◆ RVALUE_UNCOLLECTIBLE_BITMAP

#define RVALUE_UNCOLLECTIBLE_BITMAP | ( |  | obj | ) | MARKED_IN_BITMAP(GET_HEAP_UNCOLLECTIBLE_BITS(obj), (obj))

Definition at line 1225 of file gc.c.

## ◆ RVALUE_WB_UNPROTECTED_BITMAP

#define RVALUE_WB_UNPROTECTED_BITMAP | ( |  | obj | ) | MARKED_IN_BITMAP(GET_HEAP_WB_UNPROTECTED_BITS(obj), (obj))

Definition at line 1224 of file gc.c.

## ◆ RZOMBIE

#define RZOMBIE | ( |  | o | ) | ((struct RZombie *)(o))

Definition at line 974 of file gc.c.

## ◆ S [1/2]

#define S | ( |  | s | ) | sym_##s = ID2SYM(rb_intern_const(#s))

## ◆ S [2/2]

#define S | ( |  | s | ) | gc_stat_symbols[gc_stat_sym_##s] = ID2SYM(rb_intern_const(#s))

## ◆ SET [1/2]

#define SET | ( |  | name,
|  |  | attr
| ) |  |

Value:
if (key == sym_##name) \
return (attr); \
else if (hash != Qnil) \
rb_hash_aset(hash, sym_##name, (attr));
key
key
Definition: openssl_missing.h:185
Qnil
#define Qnil
Definition: special_consts.h:51

## ◆ SET [2/2]

#define SET | ( |  | name,
|  |  | attr
| ) |  |

Value:
if (key == gc_stat_symbols[gc_stat_sym_##name]) \
return attr; \
else if (hash != Qnil) \
rb_hash_aset(hash, gc_stat_symbols[gc_stat_sym_##name], SIZET2NUM(attr));
SIZET2NUM
#define SIZET2NUM
Definition: size_t.h:52

## ◆ SET_STACK_END

#define SET_STACK_END SET_MACHINE_STACK_END(&ec->machine.stack_end)

Definition at line 5479 of file gc.c.

## ◆ sighandler_t

#define sighandler_t ruby_sighandler_t

Definition at line 24 of file gc.c.

## ◆ stack_check

#define stack_check | ( |  | ec,
|  |  | water_mark
| ) |  | FALSE

Definition at line 5540 of file gc.c.

## ◆ STACK_CHUNK_SIZE

#define STACK_CHUNK_SIZE 500

Definition at line 631 of file gc.c.

## ◆ STACK_END

#define STACK_END (ec->machine.stack_end)

Definition at line 5482 of file gc.c.

## ◆ STACK_LENGTH

#define STACK_LENGTH

Value:
((STACK_END < STACK_START) ? (size_t)(STACK_START - STACK_END) \
: (size_t)(STACK_END - STACK_START + 1))

Definition at line 5495 of file gc.c.

## ◆ STACK_LEVEL_MAX

#define STACK_LEVEL_MAX (ec->machine.stack_maxsize/sizeof(VALUE))

Definition at line 5483 of file gc.c.

## ◆ STACK_START

#define STACK_START (ec->machine.stack_start)

Definition at line 5481 of file gc.c.

## ◆ STACKFRAME_FOR_CALL_CFUNC

#define STACKFRAME_FOR_CALL_CFUNC 2048

Definition at line 5543 of file gc.c.

## ◆ stress_to_class

#define stress_to_class 0

Definition at line 904 of file gc.c.

## ◆ TF

#define TF | ( |  | c | ) | ((c) != 0 ? "true" : "false")

## ◆ TICK_TYPE

#define TICK_TYPE 1

Definition at line 311 of file gc.c.

## ◆ TRY_WITH_GC

#define TRY_WITH_GC | ( |  | siz,
|  |  | alloc
| ) |  |

Value:
do { \
objspace_malloc_gc_stress(objspace); \
if (!(alloc) && \
(!garbage_collect_with_gvl(objspace, GPR_FLAG_FULL_MARK | \
GPR_FLAG_IMMEDIATE_MARK | GPR_FLAG_IMMEDIATE_SWEEP | \
GPR_FLAG_MALLOC) || \
!(alloc))) { \
ruby_memerror(); \
} \
} while (0)
GPR_FLAG_IMMEDIATE_SWEEP
@ GPR_FLAG_IMMEDIATE_SWEEP
Definition: gc.c:490
GPR_FLAG_FULL_MARK
@ GPR_FLAG_FULL_MARK
Definition: gc.c:493
GPR_FLAG_IMMEDIATE_MARK
@ GPR_FLAG_IMMEDIATE_MARK
Definition: gc.c:492
GPR_FLAG_MALLOC
@ GPR_FLAG_MALLOC
Definition: gc.c:484

Definition at line 10583 of file gc.c.

## ◆ TYPE_NAME

#define TYPE_NAME | ( |  | t | ) | case (t): return #t;

## ◆ TYPED_UPDATE_IF_MOVED

#define TYPED_UPDATE_IF_MOVED | ( |  | _objspace,
|  |  | _type,
|  |  | _thing
| ) |  |

Value:
do { \
if (gc_object_moved_p(_objspace, (VALUE)_thing)) { \
*((_type *)(&_thing)) = (_type)RMOVED((_thing))->destination; \
} \
} while (0)
RMOVED
#define RMOVED(obj)
Definition: gc.c:551
VALUE
unsigned long VALUE
Definition: value.h:38

Definition at line 1072 of file gc.c.

## ◆ UNEXPECTED_NODE

#define UNEXPECTED_NODE | ( |  | func | ) |

Value:
rb_bug(#func"(): GC does not handle T_NODE 0x%x(%p) 0x%"PRIxVALUE, \
BUILTIN_TYPE(obj), (void*)(obj), RBASIC(obj)->flags)
PRIxVALUE
#define PRIxVALUE
Definition: inttypes.h:75
RBASIC
#define RBASIC(obj)
Definition: rbasic.h:34
BUILTIN_TYPE
#define BUILTIN_TYPE
Definition: value_type.h:84

Definition at line 2380 of file gc.c.

## ◆ UPDATE_IF_MOVED

#define UPDATE_IF_MOVED | ( |  | _objspace,
|  |  | _thing
| ) |  | TYPED_UPDATE_IF_MOVED(_objspace, VALUE, _thing)

Definition at line 1078 of file gc.c.

## ◆ USE_TICK_T

#define USE_TICK_T (PRINT_ENTER_EXIT_TICK || PRINT_MEASURE_LINE || PRINT_ROOT_TICKS)

Definition at line 310 of file gc.c.

## ◆ will_be_incremental_marking

#define will_be_incremental_marking | ( |  | objspace | ) | FALSE

Definition at line 949 of file gc.c.

## ◆ WMAP_DELETE_DEAD_OBJECT_IN_MARK

#define WMAP_DELETE_DEAD_OBJECT_IN_MARK 0

Definition at line 11083 of file gc.c.

## Typedef Documentation

## ◆ bits_t

typedef uintptr_t bits_t

Definition at line 609 of file gc.c.

## ◆ each_obj_callback

typedef int each_obj_callback(void *, void *, size_t, void *)

Definition at line 3196 of file gc.c.

## ◆ gc_profile_record

typedef struct gc_profile_record gc_profile_record

## ◆ mark_stack_t

typedef struct mark_stack mark_stack_t

## ◆ rb_heap_t

typedef struct rb_heap_struct rb_heap_t

## ◆ rb_objspace_t

typedef struct rb_objspace rb_objspace_t

## ◆ RVALUE

typedef struct RVALUE RVALUE

## ◆ stack_chunk_t

typedef struct stack_chunk stack_chunk_t

## Enumeration Type Documentation

## ◆ anonymous enum

anonymous enum

Enumerator
BITS_SIZE |
BITS_BITLENGTH |

Definition at line 610 of file gc.c.

## ◆ anonymous enum

anonymous enum

Enumerator
HEAP_PAGE_ALIGN |
HEAP_PAGE_ALIGN_MASK |
HEAP_PAGE_SIZE |
HEAP_PAGE_OBJ_LIMIT |
HEAP_PAGE_BITMAP_LIMIT |
HEAP_PAGE_BITMAP_SIZE |
HEAP_PAGE_BITMAP_PLANES |

Definition at line 815 of file gc.c.

## ◆ anonymous enum

anonymous enum

Enumerator
gc_stress_no_major |
gc_stress_no_immediate_sweep |
gc_stress_full_mark_after_malloc |
gc_stress_max |

Definition at line 8082 of file gc.c.

## ◆ gc_enter_event

enum gc_enter_event

Enumerator
gc_enter_event_start |
gc_enter_event_mark_continue |
gc_enter_event_sweep_continue |
gc_enter_event_rest |
gc_enter_event_finalizer |
gc_enter_event_rb_memerror |

Definition at line 1008 of file gc.c.

## ◆ gc_mode

enum gc_mode

Enumerator
gc_mode_none |
gc_mode_marking |
gc_mode_sweeping |

Definition at line 660 of file gc.c.

## ◆ gc_profile_record_flag

enum gc_profile_record_flag

Enumerator
GPR_FLAG_NONE |
GPR_FLAG_MAJOR_BY_NOFREE |
GPR_FLAG_MAJOR_BY_OLDGEN |
GPR_FLAG_MAJOR_BY_SHADY |
GPR_FLAG_MAJOR_BY_FORCE |
GPR_FLAG_MAJOR_MASK |
GPR_FLAG_NEWOBJ |
GPR_FLAG_MALLOC |
GPR_FLAG_METHOD |
GPR_FLAG_CAPI |
GPR_FLAG_STRESS |
GPR_FLAG_IMMEDIATE_SWEEP |
GPR_FLAG_HAVE_FINALIZE |
GPR_FLAG_IMMEDIATE_MARK |
GPR_FLAG_FULL_MARK |
GPR_FLAG_COMPACT |
GPR_DEFAULT_REASON |

Definition at line 470 of file gc.c.

## ◆ gc_stat_sym

enum gc_stat_sym

Enumerator
gc_stat_sym_count |
gc_stat_sym_heap_allocated_pages |
gc_stat_sym_heap_sorted_length |
gc_stat_sym_heap_allocatable_pages |
gc_stat_sym_heap_available_slots |
gc_stat_sym_heap_live_slots |
gc_stat_sym_heap_free_slots |
gc_stat_sym_heap_final_slots |
gc_stat_sym_heap_marked_slots |
gc_stat_sym_heap_eden_pages |
gc_stat_sym_heap_tomb_pages |
gc_stat_sym_total_allocated_pages |
gc_stat_sym_total_freed_pages |
gc_stat_sym_total_allocated_objects |
gc_stat_sym_total_freed_objects |
gc_stat_sym_malloc_increase_bytes |
gc_stat_sym_malloc_increase_bytes_limit |
gc_stat_sym_minor_gc_count |
gc_stat_sym_major_gc_count |
gc_stat_sym_compact_count |
gc_stat_sym_read_barrier_faults |
gc_stat_sym_total_moved_objects |
gc_stat_sym_remembered_wb_unprotected_objects |
gc_stat_sym_remembered_wb_unprotected_objects_limit |
gc_stat_sym_old_objects |
gc_stat_sym_old_objects_limit |
gc_stat_sym_last |

Definition at line 9655 of file gc.c.

## ◆ memop_type

enum memop_type

Enumerator
MEMOP_TYPE_MALLOC |
MEMOP_TYPE_FREE |
MEMOP_TYPE_REALLOC |

Definition at line 10401 of file gc.c.

## Function Documentation

## ◆ ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS()

ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS | ( | static void | mark_locations_arrayrb_objspace_t *objspace, register const VALUE *x, register long n | ) |

## ◆ Init_GC()

void Init_GC | ( | void |  | ) |

Definition at line 12677 of file gc.c.

References CALC_EXACT_MALLOC_SIZE, GC_DEBUG, GC_ENABLE_LAZY_SWEEP, GC_PROFILE_DETAIL_MEMORY, GC_PROFILE_MORE_DETAIL, HEAP_PAGE_BITMAP_PLANES, HEAP_PAGE_BITMAP_SIZE, HEAP_PAGE_OBJ_LIMIT, HEAP_PAGE_SIZE, ID2SYM, MALLOC_ALLOCATED_SIZE, MALLOC_ALLOCATED_SIZE_CHECK, OBJ_FREEZE, OPT, Qfalse, Qtrue, rb_ary_new(), rb_cBasicObject, rb_cObject, rb_define_alloc_func(), rb_define_class_under(), rb_define_const(), rb_define_method, rb_define_module(), rb_define_module_function, rb_define_module_under(), rb_define_singleton_method, rb_eNoMemError, rb_hash_aset(), rb_hash_new(), rb_include_module(), rb_intern(), rb_mEnumerable, rb_mGC, rb_mKernel, rb_obj_id(), rb_vm_register_special_exception, RGENGC_CHECK_MODE, RGENGC_DEBUG, RGENGC_ESTIMATE_OLDMALLOC, RGENGC_PROFILE, ruby_error_nomemory, SIZET2NUM, and USE_RGENGC.

## ◆ Init_gc_stress()

void Init_gc_stress | ( | void |  | ) |

Definition at line 3189 of file gc.c.

References rb_objspace, and ruby_initial_gc_stress.

## ◆ Init_heap()

void Init_heap | ( | void |  | ) |

Definition at line 3158 of file gc.c.

References finalizer_table, heap_eden, ruby_gc_params_t::heap_init_slots, HEAP_PAGE_OBJ_LIMIT, HEAP_PAGE_SIZE, rb_objspace::id_to_obj_tbl, int(), INT2FIX, rb_objspace::invoke_time, rb_objspace::mark_stack, rb_objspace::next_object_id, OBJ_ID_INITIAL, rb_objspace::obj_to_id_tbl, ruby_gc_params_t::oldmalloc_limit_min, rb_objspace::profile, rb_objspace, rb_objspace::rgengc, ruby_enable_autocompact, st_init_numtable, and st_init_table.

Referenced by ruby_setup().

## ◆ NO_SANITIZE() [1/2]

NO_SANITIZE | ( | "memory" | ,
|  | static inline int | is_pointer_to_heaprb_objspace_t *objspace, void *ptr
| ) |  |

## ◆ NO_SANITIZE() [2/2]

NO_SANITIZE | ( | "memory" | ,
|  | static void | gc_mark_mayberb_objspace_t *objspace, VALUE ptr
| ) |  |

## ◆ rb_aligned_malloc()

void * rb_aligned_malloc | ( | size_t | alignment,
|  | size_t | size
| ) |  |

Definition at line 10344 of file gc.c.

References GC_ASSERT, malloc, and NULL.

## ◆ rb_alloc_tmp_buffer()

void * rb_alloc_tmp_buffer | ( | volatile VALUE * | store,
|  | long | len
| ) |  |

Definition at line 11007 of file gc.c.

References cnt, len, rb_alloc_tmp_buffer_with_count(), rb_eArgError, rb_raise(), and roomof.

## ◆ rb_alloc_tmp_buffer_with_count()

void * rb_alloc_tmp_buffer_with_count | ( | volatile VALUE * | store,
|  | size_t | size,
|  | size_t | cnt
| ) |  |

Definition at line 10989 of file gc.c.

References rb_imemo_tmpbuf_struct::cnt, cnt, imemo, NULL, ptr, and rb_imemo_tmpbuf_struct::ptr.

Referenced by rb_alloc_tmp_buffer().

## ◆ rb_cc_table_free()

void rb_cc_table_free | ( | VALUE | klass | ) |

Definition at line 2727 of file gc.c.

References cc_tbl_i_data::klass, and TRUE.

## ◆ rb_class_allocate_instance()

VALUE rb_class_allocate_instance | ( | VALUE | klass | ) |

Definition at line 2482 of file gc.c.

References heap_page::flags, Qundef, RGENGC_WB_PROTECTED_OBJECT, ROBJECT_EMBED, and T_OBJECT.

## ◆ rb_copy_wb_protected_attribute()

void rb_copy_wb_protected_attribute | ( | VALUE | dest,
|  | VALUE | obj
| ) |  |

Definition at line 7876 of file gc.c.

References GET_HEAP_WB_UNPROTECTED_BITS, MARK_IN_BITMAP, and rb_objspace.

## ◆ rb_data_object_wrap()

VALUE rb_data_object_wrap | ( | VALUE | klass,
|  | void * | datap,
|  | RUBY_DATA_FUNC | dmark,
|  | RUBY_DATA_FUNC | dfree
| ) |  |

Definition at line 2489 of file gc.c.

References FALSE, RUBY_ASSERT_ALWAYS, T_CLASS, and T_DATA.

## ◆ rb_data_object_zalloc()

VALUE rb_data_object_zalloc | ( | VALUE | klass,
|  | size_t | size,
|  | RUBY_DATA_FUNC | dmark,
|  | RUBY_DATA_FUNC | dfree
| ) |  |

Definition at line 2497 of file gc.c.

References DATA_PTR, rb_data_object_wrap, and xcalloc.

## ◆ rb_data_typed_object_wrap()

VALUE rb_data_typed_object_wrap | ( | VALUE | klass,
|  | void * | datap,
|  | const rb_data_type_t * | type
| ) |  |

Definition at line 2505 of file gc.c.

References RUBY_ASSERT_ALWAYS, RUBY_FL_WB_PROTECTED, T_CLASS, and T_DATA.

Referenced by rb_data_typed_object_zalloc().

## ◆ rb_data_typed_object_zalloc()

VALUE rb_data_typed_object_zalloc | ( | VALUE | klass,
|  | size_t | size,
|  | const rb_data_type_t * | type
| ) |  |

Definition at line 2513 of file gc.c.

References DATA_PTR, rb_data_typed_object_wrap(), and xcalloc.

## ◆ rb_define_finalizer()

VALUE rb_define_finalizer | ( | VALUE | obj,
|  | VALUE | block
| ) |  |

Definition at line 3604 of file gc.c.

## ◆ rb_during_gc()

int rb_during_gc | ( | void |  | ) |

Definition at line 9505 of file gc.c.

References during_gc, and rb_objspace.

Referenced by rb_ec_stack_overflow().

## ◆ rb_ec_stack_check()

int rb_ec_stack_check | ( | rb_execution_context_t * | ec | ) |

Definition at line 5546 of file gc.c.

References stack_check, and STACKFRAME_FOR_CALL_CFUNC.

## ◆ rb_ec_wb_protected_newobj_of()

VALUE rb_ec_wb_protected_newobj_of | ( | rb_execution_context_t * | ec,
|  | VALUE | klass,
|  | VALUE | flags
| ) |  |

Definition at line 2356 of file gc.c.

References FL_WB_PROTECTED, heap_page::flags, GC_ASSERT, and TRUE.

## ◆ rb_free_const_table()

void rb_free_const_table | ( | struct rb_id_table * | tbl | ) |

Definition at line 2595 of file gc.c.

References rb_id_table_foreach_values(), and rb_id_table_free().

## ◆ rb_free_tmp_buffer()

void rb_free_tmp_buffer | ( | volatile VALUE * | store | ) |

Definition at line 11019 of file gc.c.

References ATOMIC_PTR_EXCHANGE, ATOMIC_VALUE_EXCHANGE, rb_imemo_tmpbuf_struct::cnt, ptr, rb_imemo_tmpbuf_struct::ptr, and ruby_xfree().

## ◆ rb_gc()

void rb_gc | ( | void |  | ) |

Definition at line 9497 of file gc.c.

References GPR_DEFAULT_REASON, and rb_objspace.

Referenced by rb_fdopen(), rb_gc_for_fd(), rb_gc_start(), rb_reg_region_copy(), and rsock_s_accept().

## ◆ rb_gc_adjust_memory_usage()

void rb_gc_adjust_memory_usage | ( | ssize_t | diff | ) |

Definition at line 11062 of file gc.c.

References MEMOP_TYPE_REALLOC, and rb_objspace.

## ◆ rb_gc_copy_finalizer()

void rb_gc_copy_finalizer | ( | VALUE | dest,
|  | VALUE | obj
| ) |  |

Definition at line 3612 of file gc.c.

References finalizer_table, FL_FINALIZE, FL_SET, FL_TEST, rb_objspace, st_insert, and st_lookup.

## ◆ rb_gc_count()

size_t rb_gc_count | ( | void |  | ) |

Definition at line 9529 of file gc.c.

References rb_objspace::count, and rb_objspace::profile.

## ◆ rb_gc_disable()

VALUE rb_gc_disable | ( | void |  | ) |

Definition at line 9925 of file gc.c.

References rb_objspace, and rb_objspace_gc_disable().

## ◆ rb_gc_disable_no_rest()

VALUE rb_gc_disable_no_rest | ( | void |  | ) |

Definition at line 9910 of file gc.c.

References rb_objspace.

## ◆ rb_gc_enable()

VALUE rb_gc_enable | ( | void |  | ) |

Definition at line 9888 of file gc.c.

References rb_objspace, and rb_objspace_gc_enable().

## ◆ rb_gc_force_recycle()

void rb_gc_force_recycle | ( | VALUE | obj | ) |

Definition at line 7968 of file gc.c.

References CLEAR_IN_BITMAP, heap_page::flags, gc_report, GET_HEAP_MARK_BITS, GET_HEAP_MARKING_BITS, GET_HEAP_PAGE, GET_HEAP_PINNED_BITS, GET_HEAP_UNCOLLECTIBLE_BITS, GET_HEAP_WB_UNPROTECTED_BITS, is_incremental_marking, rb_objspace::mark_stack, MARKED_IN_BITMAP, rb_objspace::old_objects, rb_objspace::profile, rb_objspace, RB_VM_LOCK_ENTER, RB_VM_LOCK_LEAVE, rb_objspace::rgengc, and rb_objspace::total_freed_objects.

Referenced by rb_big_isqrt(), rb_parser_free(), and rb_str_tmp_frozen_release().

## ◆ rb_gc_latest_gc_info()

VALUE rb_gc_latest_gc_info | ( | VALUE | key | ) |

Definition at line 9634 of file gc.c.

References key, and rb_objspace.

## ◆ rb_gc_location()

VALUE rb_gc_location | ( | VALUE | value | ) |

Definition at line 9003 of file gc.c.

References BUILTIN_TYPE, GC_ASSERT, RMOVED, SPECIAL_CONST_P, T_MOVED, T_NONE, and iseq_inline_constant_cache_entry::value.

Referenced by rb_execution_context_update(), rb_fiber_update_self(), rb_iseq_update_references(), rb_raw_obj_info(), and rb_vm_update_references().

## ◆ rb_gc_mark()

void rb_gc_mark | ( | VALUE | ptr | ) |

Definition at line 6112 of file gc.c.

References ptr.

Referenced by random_mark(), rb_ast_mark(), rb_execution_context_mark(), rb_hook_list_mark(), rb_iseq_mark(), rb_iseq_mark_insn_storage(), rb_mark_end_proc(), rb_strterm_mark(), and rb_vm_mark().

## ◆ rb_gc_mark_locations()

void rb_gc_mark_locations | ( | const VALUE * | start,
|  | const VALUE * | end
| ) |  |

Definition at line 5580 of file gc.c.

References heap_page::start.

Referenced by rb_execution_context_mark().

## ◆ rb_gc_mark_machine_stack()

void rb_gc_mark_machine_stack | ( | const rb_execution_context_t * | ec | ) |

Definition at line 5869 of file gc.c.

References GET_STACK_BOUNDS, and rb_objspace.

Referenced by rb_execution_context_mark().

## ◆ rb_gc_mark_maybe()

void rb_gc_mark_maybe | ( | VALUE | obj | ) |

Definition at line 5931 of file gc.c.

Referenced by rb_gvar_var_marker().

## ◆ rb_gc_mark_movable()

void rb_gc_mark_movable | ( | VALUE | ptr | ) |

Definition at line 6106 of file gc.c.

References ptr.

Referenced by rb_execution_context_mark(), rb_fiber_mark_self(), rb_gvar_val_marker(), rb_iseq_mark(), and rb_vm_mark().

## ◆ rb_gc_mark_values()

void rb_gc_mark_values | ( | long | n,
|  | const VALUE * | values
| ) |  |

Definition at line 5596 of file gc.c.

References rb_objspace.

Referenced by rb_vm_mark().

## ◆ rb_gc_mark_vm_stack_values()

void rb_gc_mark_vm_stack_values | ( | long | n,
|  | const VALUE * | values
| ) |  |

Definition at line 5619 of file gc.c.

References rb_objspace.

Referenced by rb_execution_context_mark().

## ◆ rb_gc_ractor_newobj_cache_clear()

void rb_gc_ractor_newobj_cache_clear | ( | rb_ractor_newobj_cache_t * | newobj_cache | ) |

Definition at line 7937 of file gc.c.

References RVALUE::as, RVALUE::free, heap_page::freelist, ractor_newobj_cache::freelist, RVALUE::next, NULL, RUBY_DEBUG_LOG, and ractor_newobj_cache::using_page.

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

References ALLOC, global_list, gc_list::next, rb_objspace, and gc_list::varptr.

Referenced by Init_readline(), Init_String(), 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 8022 of file gc.c.

References MARK_OBJECT_ARY_BUCKET_SIZE, Qnil, RARRAY_LEN, rb_ary_last(), rb_ary_push(), rb_ary_tmp_new(), RB_VM_LOCK_ENTER, and RB_VM_LOCK_LEAVE.

Referenced by Init_class_hierarchy(), Init_Complex(), Init_date_core(), Init_Encoding(), Init_Exception(), Init_generator(), Init_IO(), Init_load(), Init_MemoryView(), Init_ossl_asn1(), Init_parser(), Init_sym(), Init_Time(), Init_VM(), Init_win32ole(), Init_win32ole_event(), InitVM_Enumerator(), rb_autoload_str(), rb_define_const(), rb_define_module_id_under(), rb_iseq_defined_string(), rb_profile_frame_absolute_path(), rb_sym_to_proc(), rb_vm_register_special_exception_str(), ruby_process_options(), and yyparse().

## ◆ rb_gc_start()

VALUE rb_gc_start | ( | void |  | ) |

Definition at line 9490 of file gc.c.

References Qnil, and rb_gc().

## ◆ rb_gc_stat()

size_t rb_gc_stat | ( | VALUE | key | ) |

Definition at line 9853 of file gc.c.

References key, and SYMBOL_P.

## ◆ rb_gc_unprotect_logging()

void rb_gc_unprotect_logging | ( | void * | objptr,
|  | const char * | filename,
|  | int | line
| ) |  |

Definition at line 7848 of file gc.c.

References cnt, ptr, rb_memerror(), snprintf, st_init_strtable, st_insert, st_lookup, and strdup.

## ◆ rb_gc_unregister_address()

void rb_gc_unregister_address | ( | VALUE * | addr | ) |

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

References global_list, gc_list::next, rb_objspace, t, gc_list::varptr, and xfree.

## ◆ rb_gc_update_tbl_refs()

void rb_gc_update_tbl_refs | ( | st_table * | ptr | ) |

Definition at line 8850 of file gc.c.

References ptr, and rb_objspace.

Referenced by rb_vm_update_references().

## ◆ rb_gc_verify_internal_consistency()

void rb_gc_verify_internal_consistency | ( | void |  | ) |

Definition at line 7137 of file gc.c.

## ◆ rb_gc_writebarrier()

void rb_gc_writebarrier | ( | VALUE | a,
|  | VALUE | b
| ) |  |

Definition at line 7750 of file gc.c.

References gc_writebarrier_incremental, is_incremental_marking, rb_bug(), rb_objspace, RB_VM_LOCK_ENTER_NO_BARRIER, RB_VM_LOCK_LEAVE_NO_BARRIER, RGENGC_CHECK_MODE, and SPECIAL_CONST_P.

## ◆ rb_gc_writebarrier_remember()

void rb_gc_writebarrier_remember | ( | VALUE | obj | ) |

Definition at line 7814 of file gc.c.

References gc_report, is_incremental_marking, and rb_objspace.

Referenced by rb_ary_cancel_sharing(), rb_hash_keys(), and rb_hash_values().

## ◆ rb_gc_writebarrier_unprotect()

void rb_gc_writebarrier_unprotect | ( | VALUE | obj | ) |

Definition at line 7777 of file gc.c.

References BUILTIN_TYPE, gc_report, GET_HEAP_WB_UNPROTECTED_BITS, MARK_IN_BITMAP, rb_objspace::profile, RB_DEBUG_COUNTER_INC, and rb_objspace.

## ◆ rb_gcdebug_print_obj_condition()

void rb_gcdebug_print_obj_condition | ( | VALUE | obj | ) |

## ◆ rb_global_variable()

void rb_global_variable | ( | VALUE * | var | ) |

An alias for `rb_gc_register_address()`.

Definition at line 8075 of file gc.c.

References rb_gc_register_address().

## ◆ rb_imemo_name()

const char * rb_imemo_name | ( | enum imemo_type | type | ) |

Definition at line 2385 of file gc.c.

References env, and IMEMO_NAME.

Referenced by rb_raw_obj_info().

## ◆ rb_imemo_new()

VALUE rb_imemo_new | ( | enum imemo_type | type,
|  | VALUE | v1,
|  | VALUE | v2,
|  | VALUE | v3,
|  | VALUE | v0
| ) |  |

Definition at line 2412 of file gc.c.

References FL_USHIFT, heap_page::flags, T_IMEMO, and TRUE.

Referenced by rb_ast_new(), and rb_vm_ifunc_new().

## ◆ rb_imemo_tmpbuf_parser_heap()

rb_imemo_tmpbuf_t * rb_imemo_tmpbuf_parser_heap | ( | void * | buf,
|  | rb_imemo_tmpbuf_t * | old_heap,
|  | size_t | cnt
| ) |  |

Definition at line 2432 of file gc.c.

References cnt.

## ◆ rb_iseq_free()

void rb_iseq_free | ( | const rb_iseq_t * | iseq | ) |

Definition at line 105 of file iseq.c.

References rb_iseq_struct::aux, rb_iseq_constant_body::iseq_insn_info::body, rb_iseq_struct::body, rb_iseq_constant_body::call_data, rb_iseq_constant_body::catch_table, rb_iseq_struct::exec, rb_iseq_constant_body::insns_info, rb_iseq_constant_body::is_entries, rb_iseq_constant_body::iseq_encoded, ISEQ_EXECUTABLE_P, rb_iseq_constant_body::keyword, LIKELY, rb_iseq_struct::local_hooks, rb_iseq_constant_body::local_table, NULL, rb_iseq_constant_body::opt_table, rb_iseq_constant_body::outer_variables, rb_iseq_constant_body::param, rb_iseq_constant_body::iseq_insn_info::positions, rb_hook_list_free(), rb_id_table_free(), rb_iseq_shared_exc_local_tbl, RUBY_FREE_ENTER, RUBY_FREE_LEAVE, and ruby_xfree().

## ◆ rb_iseq_mark()

void rb_iseq_mark | ( | const rb_iseq_t * | iseq | ) |

Definition at line 332 of file iseq.c.

References rb_iseq_struct::aux, rb_iseq_location_struct::base_label, rb_iseq_struct::body, rb_iseq_constant_body::call_data, rb_iseq_constant_body::catch_table, iseq_compile_data::catch_table_ary, rb_call_data::cc, rb_call_data::ci, rb_iseq_constant_body::ci_size, rb_iseq_constant_body::coverage, iseq_compile_data::err_info, rb_iseq_struct::exec, FL_TEST, FL_TEST_RAW, rb_iseq_constant_body::flags, rb_iseq_constant_body::has_kw, iseq_compile_data::insn, iseq_catch_table_entry::iseq, ISEQ_EXECUTABLE_P, ISEQ_MARKABLE_ISEQ, ISEQ_NOT_LOADED_YET, ISEQ_USE_COMPILE_DATA, rb_iseq_constant_body::keyword, rb_iseq_location_struct::label, rb_iseq_struct::loader, rb_iseq_struct::local_hooks, rb_iseq_constant_body::location, NULL, rb_iseq_struct::obj, rb_iseq_constant_body::param, rb_iseq_constant_body::parent_iseq, rb_iseq_location_struct::pathobj, rb_iseq_constant_body::pc2branchindex, rb_gc_mark(), rb_gc_mark_movable(), rb_hook_list_mark(), rb_iseq_mark_insn_storage(), rb_vm_empty_cc(), RTEST, RUBY_MARK_ENTER, RUBY_MARK_LEAVE, RUBY_MARK_MOVABLE_UNLESS_NULL, RUBY_MARK_UNLESS_NULL, SPECIAL_CONST_P, iseq_compile_data::storage_head, UNALIGNED_MEMBER_PTR, rb_iseq_constant_body::variable, VM_ASSERT, and rb_iseq_struct::wrapper.

## ◆ rb_iseq_memsize()

size_t rb_iseq_memsize | ( | const rb_iseq_t * | iseq | ) |

Definition at line 442 of file iseq.c.

References rb_iseq_struct::body, rb_iseq_constant_body::catch_table, rb_iseq_constant_body::ci_size, rb_iseq_constant_body::insns_info, int(), rb_iseq_constant_body::is_size, ISEQ_EXECUTABLE_P, rb_iseq_constant_body::iseq_size, rb_iseq_constant_body::keyword, rb_iseq_constant_body::local_table_size, iseq_compile_data_storage::next, iseq_compile_data::node, offsetof, rb_iseq_constant_body::opt_num, rb_iseq_constant_body::param, iseq_compile_data_storage::size, rb_iseq_constant_body::iseq_insn_info::size, and iseq_compile_data::storage_head.

## ◆ rb_iseq_update_references()

void rb_iseq_update_references | ( | rb_iseq_t * | iseq | ) |

Definition at line 257 of file iseq.c.

References rb_iseq_location_struct::base_label, rb_iseq_struct::body, rb_iseq_constant_body::call_data, rb_iseq_constant_body::catch_table, rb_call_data::cc, rb_call_data::ci, rb_iseq_constant_body::ci_size, rb_iseq_constant_body::coverage, FL_TEST, rb_iseq_constant_body::flags, rb_iseq_constant_body::has_kw, iseq_catch_table_entry::iseq, ISEQ_MARKABLE_ISEQ, rb_iseq_constant_body::iseq_size, rb_iseq_constant_body::keyword, rb_iseq_location_struct::label, rb_iseq_constant_body::local_iseq, rb_iseq_constant_body::location, NULL, rb_iseq_constant_body::param, rb_iseq_constant_body::parent_iseq, rb_iseq_location_struct::pathobj, rb_iseq_constant_body::pc2branchindex, Qundef, rb_gc_location(), SPECIAL_CONST_P, UNALIGNED_MEMBER_PTR, and rb_iseq_constant_body::variable.

## ◆ rb_malloc_info_show_results()

void rb_malloc_info_show_results | ( | void |  | ) |

Definition at line 10742 of file gc.c.

Referenced by ruby_default_signal().

## ◆ rb_mark_hash()

void rb_mark_hash | ( | st_table * | tbl | ) |

Definition at line 5750 of file gc.c.

## ◆ rb_mark_set()

void rb_mark_set | ( | st_table * | tbl | ) |

Definition at line 5686 of file gc.c.

Referenced by rb_iseq_build_from_ary().

## ◆ rb_mark_tbl()

void rb_mark_tbl | ( | st_table * | tbl | ) |

Definition at line 5893 of file gc.c.

Referenced by rb_vm_mark().

## ◆ rb_mark_tbl_no_pin()

void rb_mark_tbl_no_pin | ( | st_table * | tbl | ) |

Definition at line 5899 of file gc.c.

## ◆ rb_memerror()

void rb_memerror | ( | void |  | ) |

Definition at line 10309 of file gc.c.

References during_gc, EC_JUMP_TAG, rb_execution_context_struct::errinfo, gc_raise_tag::exc, EXIT_FAILURE, gc_enter_event_rb_memerror, nomem_error, NULL, RAISED_NOMEMORY, rb_ec_raised_clear, rb_ec_raised_p, rb_ec_raised_set, rb_objspace_of, ruby_vm_special_exception_copy(), and TAG_RAISE.

Referenced by rb_gc_unprotect_logging(), and rb_reg_start_with_p().

## ◆ rb_memory_id()

VALUE rb_memory_id | ( | VALUE | obj | ) |

Definition at line 4077 of file gc.c.

Referenced by rb_exec_recursive_paired(), and rb_exec_recursive_paired_outer().

## ◆ rb_method_type_name()

const char * rb_method_type_name | ( | rb_method_type_t | type | ) |

Definition at line 12177 of file gc.c.

References rb_bug(), VM_METHOD_TYPE_ALIAS, VM_METHOD_TYPE_ATTRSET, VM_METHOD_TYPE_BMETHOD, VM_METHOD_TYPE_CFUNC, VM_METHOD_TYPE_ISEQ, VM_METHOD_TYPE_IVAR, VM_METHOD_TYPE_MISSING, VM_METHOD_TYPE_NOTIMPLEMENTED, VM_METHOD_TYPE_OPTIMIZED, VM_METHOD_TYPE_REFINED, VM_METHOD_TYPE_UNDEF, and VM_METHOD_TYPE_ZSUPER.

Referenced by rb_raw_obj_info().

## ◆ rb_newobj()

VALUE rb_newobj | ( | void |  | ) |

Definition at line 2365 of file gc.c.

References FALSE, and T_NONE.

## ◆ rb_newobj_of()

VALUE rb_newobj_of | ( | VALUE | klass,
|  | VALUE | flags
| ) |  |

Definition at line 2371 of file gc.c.

References FL_WB_PROTECTED, heap_page::flags, Qundef, ROBJECT_EMBED, RUBY_T_MASK, and T_OBJECT.

## ◆ rb_obj_gc_flags()

size_t rb_obj_gc_flags | ( | VALUE | obj,
|  | ID * | flags,
|  | size_t | max
| ) |  |

Definition at line 7908 of file gc.c.

References heap_page::flags, GET_HEAP_MARK_BITS, GET_HEAP_MARKING_BITS, GET_HEAP_PINNED_BITS, I, MARKED_IN_BITMAP, and max.

Referenced by Init_objspace_dump().

## ◆ rb_obj_id()

VALUE rb_obj_id | ( | VALUE | obj | ) |

Definition at line 4110 of file gc.c.

Referenced by Init_GC().

## ◆ rb_obj_info()

const char * rb_obj_info | ( | VALUE | obj | ) |

Definition at line 12499 of file gc.c.

Referenced by rb_raw_obj_info().

## ◆ rb_obj_info_dump()

void rb_obj_info_dump | ( | VALUE | obj | ) |

Definition at line 12505 of file gc.c.

References rb_raw_obj_info().

## ◆ rb_obj_info_dump_loc()

void rb_obj_info_dump_loc | ( | VALUE | obj,
|  | const char * | file,
|  | int | line,
|  | const char * | func
| ) |  |

Definition at line 12512 of file gc.c.

References rb_raw_obj_info().

## ◆ rb_obj_is_main_ractor()

bool rb_obj_is_main_ractor | ( | VALUE | gv | ) |

Definition at line 1707 of file ractor.c.

References DATA_PTR, and rb_ractor_p().

Referenced by rb_objspace_call_finalizer().

## ◆ rb_obj_memsize_of()

size_t rb_obj_memsize_of | ( | VALUE | obj | ) |

Definition at line 4296 of file gc.c.

References TRUE.

## ◆ rb_obj_rgengc_promoted_p()

VALUE rb_obj_rgengc_promoted_p | ( | VALUE | obj | ) |

Definition at line 7902 of file gc.c.

References OBJ_PROMOTED, Qfalse, and Qtrue.

## ◆ rb_obj_rgengc_writebarrier_protected_p()

VALUE rb_obj_rgengc_writebarrier_protected_p | ( | VALUE | obj | ) |

Definition at line 7896 of file gc.c.

References Qfalse, and Qtrue.

## ◆ rb_objspace_alloc()

rb_objspace_t * rb_objspace_alloc | ( | void |  | ) |

Definition at line 1595 of file gc.c.

References dont_gc_on, rb_objspace::eden_heap, malloc_limit, ruby_gc_params_t::malloc_limit_min, rb_heap_struct::pages, and rb_objspace::tomb_heap.

Referenced by Init_BareVM().

## ◆ rb_objspace_call_finalizer()

void rb_objspace_call_finalizer | ( | rb_objspace_t * | objspace | ) |

Definition at line 3771 of file gc.c.

References RVALUE::as, ATOMIC_EXCHANGE, ATOMIC_SET, BUILTIN_TYPE, DATA_PTR, dont_gc_on, rb_objspace::dont_incremental, finalizer_table, finalizing, RVALUE::flags, rb_objspace::flags, RVALUE::free, GC_ASSERT, gc_enter_event_finalizer, heap_allocated_pages, heap_pages_deferred_final, heap_pages_sorted, force_finalize_list::next, force_finalize_list::obj, RANY, rb_obj_is_fiber(), rb_obj_is_main_ractor(), rb_obj_is_mutex(), rb_obj_is_thread(), RDATA, RUBY_DEFAULT_FREE, st_delete, st_foreach, st_free_table, T_DATA, T_FILE, T_NONE, force_finalize_list::table, and xfree.

## ◆ rb_objspace_data_type_memsize()

size_t rb_objspace_data_type_memsize | ( | VALUE | obj | ) |

Definition at line 2521 of file gc.c.

References ptr, and RTYPEDDATA_DATA.

## ◆ rb_objspace_data_type_name()

const char * rb_objspace_data_type_name | ( | VALUE | obj | ) |

Definition at line 2534 of file gc.c.

Referenced by rb_raw_obj_info().

## ◆ rb_objspace_each_objects()

void rb_objspace_each_objects | ( | each_obj_callback * | callback,
|  | void * | data
| ) |  |

Definition at line 3285 of file gc.c.

References each_obj_args::callback, and each_obj_args::data.

Referenced by rb_clear_method_cache_all(), rb_iseq_remove_coverage_all(), and rb_iseq_trace_set_all().

## ◆ rb_objspace_each_objects_without_setup()

void rb_objspace_each_objects_without_setup | ( | each_obj_callback * | callback,
|  | void * | data
| ) |  |

Definition at line 3308 of file gc.c.

References each_obj_args::callback, and each_obj_args::data.

## ◆ rb_objspace_free()

void rb_objspace_free | ( | rb_objspace_t * | objspace | ) |

Definition at line 1610 of file gc.c.

References rb_objspace::eden_heap, free, global_list, heap_allocated_pages, heap_eden, heap_pages_himem, heap_pages_lomem, heap_pages_sorted, heap_pages_sorted_length, rb_objspace::id_to_obj_tbl, is_lazy_sweeping, rb_objspace::mark_stack, gc_list::next, rb_objspace::obj_to_id_tbl, rb_objspace::profile, rb_bug(), rb_objspace::records, st_free_table, rb_heap_struct::total_pages, rb_heap_struct::total_slots, and xfree.

Referenced by ruby_vm_destruct().

## ◆ rb_objspace_garbage_object_p()

int rb_objspace_garbage_object_p | ( | VALUE | obj | ) |

Definition at line 3933 of file gc.c.

References rb_objspace.

Referenced by rb_include_module(), and rb_prepend_module().

## ◆ rb_objspace_gc_disable()

VALUE rb_objspace_gc_disable | ( | rb_objspace_t * | objspace | ) |

Definition at line 9932 of file gc.c.

Referenced by rb_gc_disable().

## ◆ rb_objspace_gc_enable()

VALUE rb_objspace_gc_enable | ( | rb_objspace_t * | objspace | ) |

Definition at line 9895 of file gc.c.

References dont_gc_off, dont_gc_val, Qfalse, and Qtrue.

Referenced by Init_VM(), and rb_gc_enable().

## ◆ rb_objspace_internal_object_p()

int rb_objspace_internal_object_p | ( | VALUE | obj | ) |

Definition at line 3355 of file gc.c.

## ◆ rb_objspace_markable_object_p()

int rb_objspace_markable_object_p | ( | VALUE | obj | ) |

Definition at line 3926 of file gc.c.

References rb_objspace.

## ◆ rb_objspace_marked_object_p()

int rb_objspace_marked_object_p | ( | VALUE | obj | ) |

Definition at line 6122 of file gc.c.

References FALSE, and TRUE.

## ◆ rb_objspace_reachable_objects_from()

void rb_objspace_reachable_objects_from | ( | VALUE | obj,
|  | void(func)(VALUE, void *) | ,
|  | void * | data
| ) |  |

Definition at line 10169 of file gc.c.

References during_gc, rb_ractor_struct::mfd, rb_bug(), and rb_objspace.

## ◆ rb_objspace_reachable_objects_from_root()

void rb_objspace_reachable_objects_from_root | ( | void(func)(const char *category, VALUE, void *) | ,
|  | void * | passing_data
| ) |  |

Definition at line 10202 of file gc.c.

References root_objects_data::func, and rb_objspace.

## ◆ rb_objspace_set_event_hook()

void rb_objspace_set_event_hook | ( | const rb_event_flag_t | event | ) |

Definition at line 2052 of file gc.c.

References rb_objspace::flags, rb_objspace::has_hook, rb_objspace::hook_events, rb_objspace, and RUBY_INTERNAL_EVENT_OBJSPACE_MASK.

## ◆ rb_ractor_p()

bool rb_ractor_p | ( | VALUE | rv | ) |

Definition at line 273 of file ractor.c.

References rb_typeddata_is_kind_of().

Referenced by rb_obj_is_main_ractor(), and rb_raw_obj_info().

## ◆ rb_raw_obj_info()

const char * rb_raw_obj_info | ( | char * | buff,
|  | const int | buff_size,
|  | VALUE | obj
| ) |  |

Definition at line 12229 of file gc.c.

References rb_method_definition_struct::alias_count, APPENDF, ARY_EMBED_P, ARY_SHARED_P, block_type_iseq, rb_method_definition_struct::body, BUFF_ARGS, BUILTIN_TYPE, C, rb_method_entry_struct::called_id, DATA_PTR, rb_method_entry_struct::def, rb_method_entry_struct::defined_class, ELTS_SHARED, FIX2LONG, FIXNUM_P, FL_TEST, rb_ractor_pub::id, imemo_callcache, imemo_callinfo, imemo_iseq, imemo_ment, rb_method_definition_struct::iseq, rb_method_iseq_struct::iseqptr, rb_callcache::klass, len, METHOD_ENTRY_CACHED, METHOD_ENTRY_COMPLEMENTED, METHOD_ENTRY_INVALIDATED, METHOD_ENTRY_VISI, METHOD_VISI_PRIVATE, METHOD_VISI_PUBLIC, NIL_P, NULL, rb_method_entry_struct::owner, PRIdSIZE, ptr, rb_ractor_struct::pub, Qnil, RANY, RARRAY, RARRAY_CONST_PTR_TRANSIENT, RARRAY_EMBED_FLAG, RARRAY_LEN, rb_class_path_cached(), rb_gc_location(), rb_id2name(), rb_imemo_name(), rb_method_type_name(), rb_obj_info(), rb_obj_is_proc(), rb_objspace_data_type_name(), rb_ractor_p(), rb_raw_obj_info(), RBASIC, RBASIC_CLASS, RHASH_SIZE, ROBJECT_EMBED, RSTRING_PTR, RSYMBOL, RTEST, RVALUE_MARK_BITMAP, RVALUE_MARKING_BITMAP, RVALUE_PIN_BITMAP, RVALUE_UNCOLLECTIBLE_BITMAP, RVALUE_WB_UNPROTECTED_BITMAP, SPECIAL_CONST_P, SYM2ID, SYMBOL_P, T_ARRAY, T_CLASS, T_DATA, T_HASH, T_ICLASS, T_IMEMO, T_MODULE, T_MOVED, T_NODE, T_OBJECT, T_STRING, T_SYMBOL, UNEXPECTED_NODE, and VM_METHOD_TYPE_ISEQ.

Referenced by rb_obj_info_dump(), rb_obj_info_dump_loc(), rb_raw_obj_info(), and ruby_debug_print_value().

## ◆ rb_size_mul_add_or_raise()

size_t rb_size_mul_add_or_raise | ( | size_t | x,
|  | size_t | y,
|  | size_t | z,
|  | VALUE | exc
| ) |  |

Definition at line 215 of file gc.c.

## ◆ rb_size_mul_or_raise()

size_t rb_size_mul_or_raise | ( | size_t | x,
|  | size_t | y,
|  | VALUE | exc
| ) |  |

Definition at line 188 of file gc.c.

## ◆ rb_undefine_finalizer()

VALUE rb_undefine_finalizer | ( | VALUE | obj | ) |

Definition at line 3453 of file gc.c.

References finalizer_table, FL_FINALIZE, FL_UNSET, rb_check_frozen, rb_objspace, and st_delete.

## ◆ rb_vm_ccs_free()

void rb_vm_ccs_free | ( | struct rb_class_cc_entries * | ccs | ) |

Definition at line 2649 of file gc.c.

References NULL, Qundef, RB_DEBUG_COUNTER_INC, and TRUE.

## ◆ rb_vm_update_references()

void rb_vm_update_references | ( | void * | ptr | ) |

Definition at line 2474 of file vm.c.

References rb_vm_struct::coverages, rb_vm_struct::expanded_load_path, rb_vm_struct::frozen_strings, rb_vm_struct::load_path, rb_vm_struct::load_path_check_cache, rb_vm_struct::load_path_snapshot, rb_vm_struct::loaded_features, rb_vm_struct::loaded_features_snapshot, rb_vm_struct::mark_object_ary, rb_vm_struct::orig_progname, ptr, rb_gc_location(), rb_gc_update_tbl_refs(), and rb_vm_struct::top_self.

## ◆ rb_wb_protected_newobj_of()

VALUE rb_wb_protected_newobj_of | ( | VALUE | klass,
|  | VALUE | flags
| ) |  |

Definition at line 2349 of file gc.c.

References FL_WB_PROTECTED, heap_page::flags, GC_ASSERT, and TRUE.

## ◆ rb_wb_unprotected_newobj_of()

VALUE rb_wb_unprotected_newobj_of | ( | VALUE | klass,
|  | VALUE | flags
| ) |  |

Definition at line 2342 of file gc.c.

References FALSE, FL_WB_PROTECTED, heap_page::flags, and GC_ASSERT.

## ◆ rb_xcalloc_mul_add_mul()

void * rb_xcalloc_mul_add_mul | ( | size_t | x,
|  | size_t | y,
|  | size_t | z,
|  | size_t | w
| ) |  |

Definition at line 10941 of file gc.c.

References rb_eArgError, and ruby_xcalloc().

## ◆ rb_xmalloc_mul_add()

void * rb_xmalloc_mul_add | ( | size_t | x,
|  | size_t | y,
|  | size_t | z
| ) |  |

Definition at line 10920 of file gc.c.

References rb_eArgError, and ruby_xmalloc().

## ◆ rb_xmalloc_mul_add_mul()

void * rb_xmalloc_mul_add_mul | ( | size_t | x,
|  | size_t | y,
|  | size_t | z,
|  | size_t | w
| ) |  |

Definition at line 10934 of file gc.c.

References rb_eArgError, and ruby_xmalloc().

## ◆ rb_xrealloc_mul_add()

void * rb_xrealloc_mul_add | ( | const void * | p,
|  | size_t | x,
|  | size_t | y,
|  | size_t | z
| ) |  |

Definition at line 10927 of file gc.c.

References rb_eArgError, and ruby_xrealloc().

## ◆ ruby_gc_set_params()

void ruby_gc_set_params | ( | void |  | ) |

Definition at line 10122 of file gc.c.

References FALSE, ruby_gc_params_t::growth_factor, ruby_gc_params_t::growth_max_slots, ruby_gc_params_t::heap_free_slots, ruby_gc_params_t::heap_free_slots_goal_ratio, ruby_gc_params_t::heap_free_slots_max_ratio, ruby_gc_params_t::heap_free_slots_min_ratio, ruby_gc_params_t::heap_init_slots, ruby_gc_params_t::malloc_limit_growth_factor, ruby_gc_params_t::malloc_limit_max, ruby_gc_params_t::malloc_limit_min, ruby_gc_params_t::oldmalloc_limit_growth_factor, ruby_gc_params_t::oldmalloc_limit_max, ruby_gc_params_t::oldmalloc_limit_min, ruby_gc_params_t::oldobject_limit_factor, rb_objspace, rb_objspace::rgengc, SIZE_MAX, and TRUE.

## ◆ ruby_get_stack_grow_direction()

int ruby_get_stack_grow_direction | ( | volatile VALUE * | addr | ) |

Definition at line 5501 of file gc.c.

References ruby_stack_grow_direction, and SET_MACHINE_STACK_END.

## ◆ ruby_malloc_size_overflow()

void ruby_malloc_size_overflow | ( | size_t | count,
|  | size_t | elsize
| ) |  |

Definition at line 10838 of file gc.c.

References count, PRIuSIZE, rb_eArgError, and rb_raise().

## ◆ ruby_mimfree()

void ruby_mimfree | ( | void * | ptr | ) |

Definition at line 10979 of file gc.c.

References free, and ptr.

Referenced by ruby_vm_destruct().

## ◆ ruby_mimmalloc()

void * ruby_mimmalloc | ( | size_t | size | ) |

Definition at line 10951 of file gc.c.

References malloc, NULL, and malloc_obj_info::size.

Referenced by Init_BareVM(), rb_ractor_main_alloc(), and rb_threadptr_root_fiber_setup().

## ◆ ruby_sized_xfree()

void ruby_sized_xfree | ( | void * | x,
|  | size_t | size
| ) |  |

Definition at line 10906 of file gc.c.

## ◆ ruby_sized_xrealloc()

void * ruby_sized_xrealloc | ( | void * | ptr,
|  | size_t | new_size,
|  | size_t | old_size
| ) |  |

Definition at line 10871 of file gc.c.

References ptr.

## ◆ ruby_sized_xrealloc2()

void * ruby_sized_xrealloc2 | ( | void * | ptr,
|  | size_t | n,
|  | size_t | size,
|  | size_t | old_n
| ) |  |

Definition at line 10890 of file gc.c.

References len, and ptr.

## ◆ ruby_xcalloc()

void * ruby_xcalloc | ( | size_t | nelems,
|  | size_t | elemsiz
| ) |  |

Identical to ruby_xmalloc2(), except it zero-fills the region before it returns.

This could also be seen as a routine identical to ruby_xmalloc(), except it calls calloc() instead of malloc() internally.

Parameters

  [in] | nelems | Number of elements.
  [in] | elemsiz | Size of an element.

Exceptions

  rb_eNoMemError | No space left for allocation.
  rb_eArgError | `nelems` * `elemsiz` would overflow.

Returns
  A valid pointer to an allocated storage instance; which has at least `nelems` * `elemsiz` bytes width, with appropriate alignment detected by the underlying calloc() routine.

Note
  It doesn't return NULL.
  Unlike some calloc() implementations, it allocates something and returns a meaningful value even when `nelems` or `elemsiz` or both are zero.

Warning
  The return value shall be invalidated exactly once by either ruby_xfree(), ruby_xrealloc(), or ruby_xrealloc2(). It is a failure to pass it to system free(), because the system and Ruby might or might not share the same malloc() implementation.

Definition at line 12815 of file gc.c.

References ruby_xcalloc_body().

Referenced by getifaddrs(), rb_iseq_defined_string(), and rb_xcalloc_mul_add_mul().

## ◆ ruby_xcalloc_body()

void * ruby_xcalloc_body | ( | size_t | n,
|  | size_t | size
| ) |  |

Definition at line 10862 of file gc.c.

Referenced by ruby_xcalloc().

## ◆ ruby_xfree()

void ruby_xfree | ( | void * | ptr | ) |

Deallocates a storage instance.

Parameters

  [out] | ptr | Either NULL, or a valid pointer previously returned from one of ruby_xmalloc(), ruby_xmalloc2(), ruby_xcalloc(), ruby_xrealloc(), or ruby_xrealloc2().

Warning
  Every single storage instance that was previously allocated by either ruby_xmalloc(), ruby_xmalloc2(), ruby_xcalloc(), ruby_xrealloc(), or ruby_xrealloc2() shall be invalidated exactly once by either passing it to ruby_xfree(), or passing it to either ruby_xrealloc(), ruby_xrealloc2() then check the return value for invalidation.
  Do not pass anything other than pointers described above. For instance pointers returned from malloc() or mmap() shall not be passed to this function, because the underlying memory management mechanism could differ.
  Do not pass any invalid pointers to this function e.g. by calling it twice with a same argument.

Definition at line 10914 of file gc.c.

References ruby_sized_xfree.

Referenced by freeifaddrs(), getifaddrs(), Init_fiddle(), rb_fiddle_free(), rb_free_tmp_buffer(), rb_iseq_free(), rb_iseq_insns_info_encode_positions(), rb_ractor_finish_marking(), and rb_str_resize().

## ◆ ruby_xmalloc()

void * ruby_xmalloc | ( | size_t | size | ) |

Allocates a storage instance.

It is largely the same as system malloc(), except:

- It raises Ruby exceptions instead of returning NULL, and
- In case of `ENOMEM` it tries to GC to make some room.

Parameters

  [in] | size | Requested amount of memory.

Exceptions

  rb_eNoMemError | No space left for `size` bytes allocation.

Returns
  A valid pointer to an allocated storage instance; which has at least `size` bytes width, with appropriate alignment detected by the underlying malloc() routine.

Note
  It doesn't return NULL.
  Unlike some malloc() implementations, it allocates something and returns a meaningful value even when `size` is equal to zero.

Warning
  The return value shall be invalidated exactly once by either ruby_xfree(), ruby_xrealloc(), or ruby_xrealloc2(). It is a failure to pass it to system free(), because the system and Ruby might or might not share the same malloc() implementation.

Definition at line 12795 of file gc.c.

References ruby_xmalloc_body().

Referenced by getifaddrs(), rb_xmalloc_mul_add(), and rb_xmalloc_mul_add_mul().

## ◆ ruby_xmalloc2()

void * ruby_xmalloc2 | ( | size_t | nelems,
|  | size_t | elemsiz
| ) |  |

Identical to ruby_xmalloc(), except it allocates `nelems` * `elemsiz` bytes.

This is needed because the multiplication could integer overflow. On such situations Ruby does not try to allocate at all but raises Ruby level exceptions instead. If there is no integer overflow the behaviour is exactly the same as `ruby_xmalloc(nelems*elemsiz)`.

Parameters

  [in] | nelems | Number of elements.
  [in] | elemsiz | Size of an element.

Exceptions

  rb_eNoMemError | No space left for allocation.
  rb_eArgError | `nelems` * `elemsiz` would overflow.

Returns
  A valid pointer to an allocated storage instance; which has at least `nelems` * `elemsiz` bytes width, with appropriate alignment detected by the underlying malloc() routine.

Note
  It doesn't return NULL.
  Unlike some malloc() implementations, it allocates something and returns a meaningful value even when `nelems` or `elemsiz` or both are zero.

Warning
  The return value shall be invalidated exactly once by either ruby_xfree(), ruby_xrealloc(), or ruby_xrealloc2(). It is a failure to pass it to system free(), because the system and Ruby might or might not share the same malloc() implementation.

Definition at line 12805 of file gc.c.

References ruby_xmalloc2_body().

## ◆ ruby_xmalloc2_body()

void * ruby_xmalloc2_body | ( | size_t | n,
|  | size_t | size
| ) |  |

Definition at line 10846 of file gc.c.

Referenced by ruby_xmalloc2().

## ◆ ruby_xmalloc_body()

void * ruby_xmalloc_body | ( | size_t | size | ) |

Definition at line 10829 of file gc.c.

Referenced by ruby_xmalloc().

## ◆ ruby_xrealloc()

void * ruby_xrealloc | ( | void * | ptr,
|  | size_t | newsiz
| ) |  |

Resize the storage instance.

Parameters

  [in] | ptr | A valid pointer to a storage instance that was previously returned from either ruby_xmalloc(), ruby_xmalloc2(), ruby_xcalloc(), ruby_xrealloc(), or ruby_xrealloc2().
  [in] | newsiz | Requested new amount of memory.

Exceptions

  rb_eNoMemError | No space left for `newsiz` bytes allocation.

Return values

  ptr | In case the function returns the passed pointer as-is, the storage instance that the pointer holds is either grown or shrunken to have at least `newsiz` bytes.
  otherwise | A valid pointer to a newly allocated storage instance which has at least `newsiz` bytes width, and holds previous contents of `ptr`. In this case `ptr` is invalidated as if it was passed to ruby_xfree().

Note
  It doesn't return NULL.

Warning
  Unlike some realloc() implementations, passing zero to `elemsiz` is not the same as calling ruby_xfree(), because this function never returns NULL. Something meaningful still returns then.
  It is a failure not to check the return value. Do not assume anything on it. It could be either identical to, or distinct form the passed argument.
  Do not assume anything on the alignment of the return value. There is no guarantee that it inherits the passed argument's one.
  The return value shall be invalidated exactly once by either ruby_xfree(), ruby_xrealloc(), or ruby_xrealloc2(). It is a failure to pass it to system free(), because the system and Ruby might or might not share the same malloc() implementation.

Definition at line 12825 of file gc.c.

References ptr, and ruby_xrealloc_body().

Referenced by rb_xrealloc_mul_add().

## ◆ ruby_xrealloc2()

void * ruby_xrealloc2 | ( | void * | ptr,
|  | size_t | newelems,
|  | size_t | newsiz
| ) |  |

Identical to ruby_xrealloc(), except it resizes the given storage instance to `newelems` * `newsiz` bytes.

This is needed because the multiplication could integer overflow. On such situations Ruby does not try to touch the contents of argument pointer at all but raises Ruby level exceptions instead. If there is no integer overflow the behaviour is exactly the same as `ruby_xrealloc(ptr,nelems*elemsiz)`.

This is roughly the same as reallocarray() function that OpenBSD etc. provides, but also interacts with our GC.

Parameters

  [in] | ptr | A valid pointer to a storage instance that was previously returned from either ruby_xmalloc(), ruby_xmalloc2(), ruby_xcalloc(), ruby_xrealloc(), or ruby_xrealloc2().
  [in] | newelems | Requested new number of elements.
  [in] | newsiz | Requested new size of each element.

Exceptions

  rb_eNoMemError | No space left for allocation.
  rb_eArgError | `newelems` * `newsiz` would overflow.

Return values

  ptr | In case the function returns the passed pointer as-is, the storage instance that the pointer holds is either grown or shrunken to have at least `newelems` * `newsiz` bytes.
  otherwise | A valid pointer to a newly allocated storage instance which has at least `newelems` * `newsiz` bytes width, and holds previous contents of `ptr`. In this case `ptr` is invalidated as if it was passed to ruby_xfree().

Note
  It doesn't return NULL.

Warning
  Unlike some realloc() implementations, passing zero to either `newelems` or `elemsiz` are not the same as calling ruby_xfree(), because this function never returns NULL. Something meaningful still returns then.
  It is a failure not to check the return value. Do not assume anything on it. It could be either identical to, or distinct form the passed argument.
  Do not assume anything on the alignment of the return value. There is no guarantee that it inherits the passed argument's one.
  The return value shall be invalidated exactly once by either ruby_xfree(), ruby_xrealloc(), or ruby_xrealloc2(). It is a failure to pass it to system free(), because the system and Ruby might or might not share the same malloc() implementation.

Definition at line 12835 of file gc.c.

References ptr, and ruby_xrealloc2_body().

## ◆ ruby_xrealloc2_body()

void * ruby_xrealloc2_body | ( | void * | ptr,
|  | size_t | n,
|  | size_t | size
| ) |  |

Definition at line 10897 of file gc.c.

References ptr, and ruby_sized_xrealloc2.

Referenced by ruby_xrealloc2().

## ◆ ruby_xrealloc_body()

void * ruby_xrealloc_body | ( | void * | ptr,
|  | size_t | new_size
| ) |  |

Definition at line 10881 of file gc.c.

References ptr, and ruby_sized_xrealloc.

Referenced by ruby_xrealloc().

## Variable Documentation

## ◆ rb_mGC

VALUE rb_mGC

Definition at line 981 of file gc.c.

Referenced by Init_GC().

## ◆ ruby_disable_gc

int ruby_disable_gc = 0

Definition at line 982 of file gc.c.

## ◆ ruby_enable_autocompact

int ruby_enable_autocompact = 0

Definition at line 983 of file gc.c.

Referenced by Init_heap().

## ◆ ruby_global_symbols

rb_symbols_t ruby_global_symbols
| extern

Definition at line 76 of file symbol.c.

Referenced by Init_sym(), and rb_sym_immortal_count().

## ◆ ruby_initial_gc_stress_ptr

VALUE* ruby_initial_gc_stress_ptr = &ruby_initial_gc_stress

Definition at line 879 of file gc.c.

Referenced by ruby_env_debug_option().

## ◆ ruby_rgengc_debug

int ruby_rgengc_debug

Definition at line 383 of file gc.c.

Referenced by ruby_env_debug_option().

## ◆ ruby_stack_grow_direction

int ruby_stack_grow_direction

Definition at line 5499 of file gc.c.

Referenced by ruby_get_stack_grow_direction().