Ruby  2.5.0dev(2017-10-22revision60238)
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
gc.c File Reference
#include "internal.h"
#include "ruby/st.h"
#include "ruby/re.h"
#include "ruby/io.h"
#include "ruby/thread.h"
#include "ruby/util.h"
#include "ruby/debug.h"
#include "eval_intern.h"
#include "vm_core.h"
#include "gc.h"
#include "constant.h"
#include "ruby_atomic.h"
#include "probes.h"
#include "id_table.h"
#include <stdio.h>
#include <stdarg.h>
#include <setjmp.h>
#include <sys/types.h>
#include "ruby_assert.h"
#include "debug_counter.h"
#include "regint.h"

Go to the source code of this file.

Data Structures

struct  ruby_gc_params_t
 
struct  gc_profile_record
 
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  rb_objspace::mark_func_data_struct
 
struct  heap_page
 
struct  RZombie
 
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  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 ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS
 
#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)   ((RGENGC_DEBUG) >= (level))
 
#define RGENGC_CHECK_MODE   0
 
#define GC_ASSERT(expr)   ((void)0)
 
#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   0
 
#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 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_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 dont_gc   objspace->flags.dont_gc
 
#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 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)   ((objspace)->flags.during_incremental_marking != FALSE)
 
#define will_be_incremental_marking(objspace)   ((objspace)->rgengc.need_major_gc != GPR_FLAG_NONE)
 
#define has_sweeping_pages(heap)   ((heap)->sweep_pages != 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 gc_prof_record(objspace)   (objspace)->profile.current_record
 
#define gc_prof_enabled(objspace)   ((objspace)->profile.run && (objspace)->profile.current_record)
 
#define gc_report   if (!RGENGC_DEBUG_ENABLED(0)) {} else gc_report_body
 
#define PUSH_MARK_FUNC_DATA(v)
 
#define POP_MARK_FUNC_DATA()   objspace->mark_func_data = prev_mark_func_data;} while (0)
 
#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_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(objspace, event, data)
 
#define RESTORE_FINALIZER()
 
#define NUM2PTR(x)   NUM2ULONG(x)
 
#define COUNT_TYPE(t)   case (t): type = 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 STACKFRAME_FOR_CALL_CFUNC   838
 
#define GET_STACK_BOUNDS(start, end, appendix)
 
#define MARK_CHECKPOINT_PRINT_TICK(category)
 
#define MARK_CHECKPOINT(category)
 
#define PROFILE_REMEMBERSET_MARK   0
 
#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 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 S(s)   gc_stat_compat_symbols[gc_stat_compat_sym_##s] = ID2SYM(rb_intern_const(#s))
 
#define OLD_SYM(s)   gc_stat_compat_symbols[gc_stat_compat_sym_##s]
 
#define NEW_SYM(s)   gc_stat_symbols[gc_stat_sym_##s]
 
#define SET(name, attr)
 
#define TRY_WITH_GC(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 TF(c)   ((c) != 0 ? "true" : "false")
 
#define C(c, s)   ((c) != 0 ? (s) : " ")
 
#define IMEMO_NAME(x)   case imemo_##x: imemo_name = #x; break;
 
#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_BY_OLDMALLOC = 0x020, 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
}
 
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)), REQUIRED_SIZE_BY_MALLOC = (sizeof(size_t) * 5), HEAP_PAGE_SIZE = (HEAP_PAGE_ALIGN - REQUIRED_SIZE_BY_MALLOC),
  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 = USE_RGENGC ? 4 : 1
}
 
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_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_oldmalloc_increase_bytes,
  gc_stat_sym_oldmalloc_increase_bytes_limit, gc_stat_sym_last
}
 
enum  gc_stat_compat_sym {
  gc_stat_compat_sym_gc_stat_heap_used, gc_stat_compat_sym_heap_eden_page_length, gc_stat_compat_sym_heap_tomb_page_length, gc_stat_compat_sym_heap_increment,
  gc_stat_compat_sym_heap_length, gc_stat_compat_sym_heap_live_slot, gc_stat_compat_sym_heap_free_slot, gc_stat_compat_sym_heap_final_slot,
  gc_stat_compat_sym_heap_swept_slot, gc_stat_compat_sym_remembered_shady_object, gc_stat_compat_sym_remembered_shady_object_limit, gc_stat_compat_sym_old_object,
  gc_stat_compat_sym_old_object_limit, gc_stat_compat_sym_total_allocated_object, gc_stat_compat_sym_total_freed_object, gc_stat_compat_sym_malloc_increase,
  gc_stat_compat_sym_malloc_limit, gc_stat_compat_sym_oldmalloc_increase, gc_stat_compat_sym_oldmalloc_limit, gc_stat_compat_sym_last
}
 
enum  memop_type { MEMOP_TYPE_MALLOC = 1, MEMOP_TYPE_FREE = 2, MEMOP_TYPE_REALLOC = 3 }
 

Functions

volatile VALUErb_gc_guarded_ptr_val (volatile VALUE *ptr, VALUE val)
 
void rb_iseq_mark (const rb_iseq_t *iseq)
 
void rb_iseq_free (const rb_iseq_t *iseq)
 
void rb_gcdebug_print_obj_condition (VALUE obj)
 
 PRINTF_ARGS (static void gc_report_body(int level, rb_objspace_t *objspace, const char *fmt,...), 3, 4)
 
rb_objspace_trb_objspace_alloc (void)
 
void rb_objspace_free (rb_objspace_t *objspace)
 
void rb_objspace_set_event_hook (const rb_event_flag_t event)
 
 NOINLINE (static VALUE newobj_slowpath_wb_protected(VALUE klass, VALUE flags, VALUE v1, VALUE v2, VALUE v3, rb_objspace_t *objspace))
 
VALUE rb_wb_unprotected_newobj_of (VALUE klass, VALUE flags)
 
VALUE rb_wb_protected_newobj_of (VALUE klass, VALUE flags)
 
VALUE rb_newobj (void)
 
VALUE rb_newobj_of (VALUE klass, VALUE flags)
 
NODErb_node_newnode (enum node_type type, VALUE a0, VALUE a1, VALUE a2)
 
VALUE rb_imemo_new (enum imemo_type type, VALUE v1, VALUE v2, VALUE v3, VALUE v0)
 
VALUE rb_data_object_wrap (VALUE klass, void *datap, RUBY_DATA_FUNC dmark, RUBY_DATA_FUNC dfree)
 
 RUBY_ALIAS_FUNCTION (rb_data_object_alloc(VALUE klass, void *datap, RUBY_DATA_FUNC dmark, RUBY_DATA_FUNC dfree), rb_data_object_wrap,(klass, datap, dmark, dfree))
 
VALUE rb_data_typed_object_wrap (VALUE klass, void *datap, const rb_data_type_t *type)
 
 RUBY_ALIAS_FUNCTION (rb_data_typed_object_alloc(VALUE klass, void *datap, const rb_data_type_t *type), rb_data_typed_object_wrap,(klass, datap, 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 Init_heap (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)
 
void rb_gc_finalize_deferred (void)
 
void rb_gc_call_finalizer_at_exit (void)
 
 PUREFUNC (static inline int is_id_value(rb_objspace_t *objspace, VALUE ptr))
 
int rb_objspace_markable_object_p (VALUE obj)
 
int rb_objspace_garbage_object_p (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_threadptr_stack_check (rb_thread_t *th)
 
int ruby_stack_check (void)
 
void rb_gc_mark_locations (const VALUE *start, const VALUE *end)
 
void rb_gc_mark_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_gc_mark_maybe (VALUE obj)
 
 NOINLINE (static void gc_mark_ptr(rb_objspace_t *objspace, VALUE obj))
 
void rb_gc_mark (VALUE ptr)
 
int rb_objspace_marked_object_p (VALUE obj)
 
void rb_gc_verify_internal_consistency (void)
 
 NOINLINE (static void gc_writebarrier_generational(VALUE a, VALUE b, rb_objspace_t *objspace))
 
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_force_recycle (VALUE obj)
 
void rb_gc_register_mark_object (VALUE obj)
 
void rb_gc_register_address (VALUE *addr)
 
void rb_gc_unregister_address (VALUE *addr)
 
void rb_global_variable (VALUE *var)
 
int rb_garbage_collect (void)
 
void Init_stack (volatile VALUE *addr)
 
VALUE rb_gc_start (void)
 
void rb_gc (void)
 
int rb_during_gc (void)
 
int rb_threadptr_during_gc (rb_thread_t *th)
 
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_gc_disable (void)
 
void ruby_gc_set_params (int safe_level)
 
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 * ruby_xmalloc (size_t size)
 
void ruby_malloc_size_overflow (size_t count, size_t elsize)
 
void * ruby_xmalloc2 (size_t n, size_t size)
 
void * ruby_xcalloc (size_t n, size_t size)
 
void * ruby_sized_xrealloc (void *ptr, size_t new_size, size_t old_size)
 
void * ruby_xrealloc (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 (void *ptr, size_t n, size_t size)
 
void ruby_sized_xfree (void *x, size_t size)
 
void ruby_xfree (void *x)
 
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_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 Init_GC (void)
 

Variables

volatile VALUE rb_gc_guarded_val
 
int ruby_rgengc_debug
 
VALUEruby_initial_gc_stress_ptr = &ruby_initial_gc_stress
 
int ruby_gc_debug_indent = 0
 
VALUE rb_mGC
 
int ruby_disable_gc = 0
 
int ruby_stack_grow_direction
 

Macro Definition Documentation

◆ ARY_EMBED_P

#define ARY_EMBED_P (   ary)
Value:
FL_TEST((ary), RARRAY_EMBED_FLAG)!=0)
#define ELTS_SHARED
Definition: ruby.h:937
#define GC_ASSERT(expr)
Definition: gc.c:252
#define FL_TEST(x, f)
Definition: ruby.h:1282

Definition at line 9273 of file gc.c.

◆ ARY_SHARED_P

#define ARY_SHARED_P (   ary)
Value:
FL_TEST((ary),ELTS_SHARED)!=0)
#define ELTS_SHARED
Definition: ruby.h:937
#define GC_ASSERT(expr)
Definition: gc.c:252
#define FL_TEST(x, f)
Definition: ruby.h:1282

Definition at line 9270 of file gc.c.

◆ ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS

#define ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS

Definition at line 66 of file gc.c.

◆ BITMAP_BIT

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

Definition at line 712 of file gc.c.

◆ BITMAP_INDEX

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

Definition at line 710 of file gc.c.

◆ BITMAP_OFFSET

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

Definition at line 711 of file gc.c.

◆ C

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

◆ CALC_EXACT_MALLOC_SIZE

#define CALC_EXACT_MALLOC_SIZE   0

Definition at line 320 of file gc.c.

◆ CEILDIV

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

Definition at line 665 of file gc.c.

◆ CLEAR_IN_BITMAP

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

Definition at line 717 of file gc.c.

◆ COUNT_TYPE

#define COUNT_TYPE (   t)    case (t): type = ID2SYM(rb_intern(#t)); break;

◆ dont_gc

#define dont_gc   objspace->flags.dont_gc

Definition at line 754 of file gc.c.

Referenced by rb_gc_disable(), and rb_gc_enable().

◆ during_gc

#define during_gc   objspace->flags.during_gc

Definition at line 755 of file gc.c.

Referenced by rb_during_gc(), rb_memerror(), and rb_threadptr_during_gc().

◆ finalizer_table

#define finalizer_table   objspace->finalizer_table

Definition at line 757 of file gc.c.

Referenced by rb_gc_copy_finalizer(), and rb_undefine_finalizer().

◆ finalizing

#define finalizing   objspace->atomic_flags.finalizing

Definition at line 756 of file gc.c.

◆ FL_CHECK2

#define FL_CHECK2 (   name,
  x,
  pred 
)
Value:
(rb_bug(name": SPECIAL_CONST (%p)", (void *)(x)), 0) : (pred))
void rb_bug(const char *fmt,...)
Definition: error.c:521
#define RGENGC_CHECK_MODE
Definition: gc.c:246
const char * name
Definition: nkf.c:208
#define SPECIAL_CONST_P(x)
Definition: ruby.h:1242

Definition at line 1027 of file gc.c.

◆ FL_SET2

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

Definition at line 1031 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 1030 of file gc.c.

◆ FL_UNSET2

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

Definition at line 1032 of file gc.c.

◆ GC_ASSERT

#define GC_ASSERT (   expr)    ((void)0)

Definition at line 252 of file gc.c.

Referenced by rb_wb_protected_newobj_of(), and rb_wb_unprotected_newobj_of().

◆ GC_DEBUG

#define GC_DEBUG   0

Definition at line 212 of file gc.c.

◆ GC_DEBUG_STRESS_TO_CLASS

#define GC_DEBUG_STRESS_TO_CLASS   0

Definition at line 334 of file gc.c.

◆ GC_ENABLE_INCREMENTAL_MARK

#define GC_ENABLE_INCREMENTAL_MARK   USE_RINCGC

Definition at line 314 of file gc.c.

◆ GC_ENABLE_LAZY_SWEEP

#define GC_ENABLE_LAZY_SWEEP   1

Definition at line 317 of file gc.c.

◆ gc_event_hook

#define gc_event_hook (   objspace,
  event,
  data 
)
Value:
do { \
if (UNLIKELY(gc_event_hook_needed_p(objspace, event))) { \
gc_event_hook_body(GET_THREAD(), (objspace), (event), (data)); \
} \
} while (0)
#define GET_THREAD()
Definition: vm_core.h:1583
#define UNLIKELY(x)
Definition: internal.h:43
#define gc_event_hook_needed_p(objspace, event)
Definition: gc.c:1825

Definition at line 1827 of file gc.c.

◆ gc_event_hook_available_p

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

Definition at line 1824 of file gc.c.

◆ gc_event_hook_needed_p

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

Definition at line 1825 of file gc.c.

◆ GC_HEAP_FREE_SLOTS

#define GC_HEAP_FREE_SLOTS   4096

Definition at line 109 of file gc.c.

◆ GC_HEAP_FREE_SLOTS_GOAL_RATIO

#define GC_HEAP_FREE_SLOTS_GOAL_RATIO   0.40

Definition at line 125 of file gc.c.

◆ GC_HEAP_FREE_SLOTS_MAX_RATIO

#define GC_HEAP_FREE_SLOTS_MAX_RATIO   0.65

Definition at line 128 of file gc.c.

◆ GC_HEAP_FREE_SLOTS_MIN_RATIO

#define GC_HEAP_FREE_SLOTS_MIN_RATIO   0.20

Definition at line 122 of file gc.c.

◆ GC_HEAP_GROWTH_FACTOR

#define GC_HEAP_GROWTH_FACTOR   1.8

Definition at line 112 of file gc.c.

◆ GC_HEAP_GROWTH_MAX_SLOTS

#define GC_HEAP_GROWTH_MAX_SLOTS   0 /* 0 is disable */

Definition at line 115 of file gc.c.

◆ GC_HEAP_INIT_SLOTS

#define GC_HEAP_INIT_SLOTS   10000

Definition at line 106 of file gc.c.

◆ GC_HEAP_OLDOBJECT_LIMIT_FACTOR

#define GC_HEAP_OLDOBJECT_LIMIT_FACTOR   2.0

Definition at line 118 of file gc.c.

◆ GC_MALLOC_LIMIT_GROWTH_FACTOR

#define GC_MALLOC_LIMIT_GROWTH_FACTOR   1.4

Definition at line 138 of file gc.c.

◆ GC_MALLOC_LIMIT_MAX

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

Definition at line 135 of file gc.c.

◆ GC_MALLOC_LIMIT_MIN

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

Definition at line 132 of file gc.c.

◆ gc_mode

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

Definition at line 783 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 784 of file gc.c.

◆ GC_NOTIFY

#define GC_NOTIFY   0

Definition at line 6281 of file gc.c.

◆ GC_OLDMALLOC_LIMIT_GROWTH_FACTOR

#define GC_OLDMALLOC_LIMIT_GROWTH_FACTOR   1.2

Definition at line 145 of file gc.c.

◆ GC_OLDMALLOC_LIMIT_MAX

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

Definition at line 148 of file gc.c.

◆ GC_OLDMALLOC_LIMIT_MIN

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

Definition at line 142 of file gc.c.

◆ gc_prof_enabled

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

Definition at line 911 of file gc.c.

◆ gc_prof_record

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

Definition at line 910 of file gc.c.

◆ GC_PROFILE_DETAIL_MEMORY

#define GC_PROFILE_DETAIL_MEMORY   0

Definition at line 311 of file gc.c.

◆ GC_PROFILE_MORE_DETAIL

#define GC_PROFILE_MORE_DETAIL   0

Definition at line 308 of file gc.c.

◆ GC_PROFILE_RECORD_DEFAULT_SIZE

#define GC_PROFILE_RECORD_DEFAULT_SIZE   100

Definition at line 8596 of file gc.c.

◆ gc_report

#define gc_report   if (!RGENGC_DEBUG_ENABLED(0)) {} else gc_report_body

Definition at line 917 of file gc.c.

Referenced by rb_gc_writebarrier_remember().

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

◆ GET_HEAP_MARK_BITS

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

Definition at line 720 of file gc.c.

◆ GET_HEAP_MARKING_BITS

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

Definition at line 724 of file gc.c.

◆ GET_HEAP_PAGE

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

Definition at line 707 of file gc.c.

◆ GET_HEAP_UNCOLLECTIBLE_BITS

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

Definition at line 722 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 723 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 705 of file gc.c.

◆ GET_PAGE_HEADER

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

Definition at line 706 of file gc.c.

◆ GET_STACK_BOUNDS

#define GET_STACK_BOUNDS (   start,
  end,
  appendix 
)
Value:
((start) = STACK_END, (end) = STACK_START) : ((start) = STACK_START, (end) = STACK_END+(appendix)))
#define STACK_START
Definition: gc.c:3982
#define STACK_END
Definition: gc.c:3983

Definition at line 4241 of file gc.c.

Referenced by rb_gc_mark_machine_stack().

◆ global_list

#define global_list   objspace->global_list

Definition at line 758 of file gc.c.

Referenced by rb_gc_register_address(), rb_gc_unregister_address(), and rb_objspace_free().

◆ has_sweeping_pages

#define has_sweeping_pages (   heap)    ((heap)->sweep_pages != 0)

Definition at line 803 of file gc.c.

◆ heap_allocatable_pages

#define heap_allocatable_pages   objspace->heap_pages.allocatable_pages

Definition at line 748 of file gc.c.

◆ heap_allocated_pages

#define heap_allocated_pages   objspace->heap_pages.allocated_pages

Definition at line 744 of file gc.c.

Referenced by rb_objspace_free().

◆ heap_eden

#define heap_eden   (&objspace->eden_heap)

Definition at line 752 of file gc.c.

Referenced by rb_objspace_free().

◆ HEAP_PAGE_ALIGN_LOG

#define HEAP_PAGE_ALIGN_LOG   14

Definition at line 663 of file gc.c.

◆ heap_pages_deferred_final

#define heap_pages_deferred_final   objspace->heap_pages.deferred_final

Definition at line 751 of file gc.c.

◆ heap_pages_final_slots

#define heap_pages_final_slots   objspace->heap_pages.final_slots

Definition at line 750 of file gc.c.

◆ heap_pages_freeable_pages

#define heap_pages_freeable_pages   objspace->heap_pages.freeable_pages

Definition at line 749 of file gc.c.

◆ heap_pages_himem

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

Definition at line 747 of file gc.c.

◆ heap_pages_lomem

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

Definition at line 746 of file gc.c.

◆ heap_pages_sorted

#define heap_pages_sorted   objspace->heap_pages.sorted

Definition at line 743 of file gc.c.

Referenced by rb_objspace_free().

◆ heap_pages_sorted_length

#define heap_pages_sorted_length   objspace->heap_pages.sorted_length

Definition at line 745 of file gc.c.

◆ heap_tomb

#define heap_tomb   (&objspace->tomb_heap)

Definition at line 753 of file gc.c.

◆ I

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

◆ IMEMO_NAME

#define IMEMO_NAME (   x)    case imemo_##x: imemo_name = #x; break;

◆ is_full_marking

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

Definition at line 789 of file gc.c.

◆ is_incremental_marking

#define is_incremental_marking (   objspace)    ((objspace)->flags.during_incremental_marking != FALSE)

Definition at line 794 of file gc.c.

Referenced by rb_gc_writebarrier().

◆ is_lazy_sweeping

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

Definition at line 804 of file gc.c.

Referenced by rb_objspace_free().

◆ is_marking

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

Definition at line 786 of file gc.c.

◆ is_sweeping

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

Definition at line 787 of file gc.c.

◆ MALLOC_ALLOCATED_SIZE

#define MALLOC_ALLOCATED_SIZE   0

Definition at line 327 of file gc.c.

◆ malloc_allocated_size

#define malloc_allocated_size   objspace->malloc_params.allocated_size

Definition at line 742 of file gc.c.

◆ MALLOC_ALLOCATED_SIZE_CHECK

#define MALLOC_ALLOCATED_SIZE_CHECK   0

Definition at line 330 of file gc.c.

◆ malloc_increase

#define malloc_increase   objspace->malloc_params.increase

Definition at line 741 of file gc.c.

◆ malloc_limit

#define malloc_limit   objspace->malloc_params.limit

Definition at line 740 of file gc.c.

Referenced by rb_objspace_alloc().

◆ 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,
 
)    ((bits)[BITMAP_INDEX(p)] = (bits)[BITMAP_INDEX(p)] | BITMAP_BIT(p))

Definition at line 716 of file gc.c.

◆ MARK_OBJECT_ARY_BUCKET_SIZE

#define MARK_OBJECT_ARY_BUCKET_SIZE   1024

Definition at line 6223 of file gc.c.

Referenced by rb_gc_register_mark_object().

◆ MARKED_IN_BITMAP

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

Definition at line 715 of file gc.c.

◆ MEASURE_LINE

#define MEASURE_LINE (   expr)    expr

Definition at line 1024 of file gc.c.

◆ NEW_SYM

#define NEW_SYM (   s)    gc_stat_symbols[gc_stat_sym_##s]

◆ nomem_error

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

Definition at line 828 of file gc.c.

◆ nonspecial_obj_id

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

Definition at line 807 of file gc.c.

Referenced by rb_obj_id().

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

◆ obj_id_to_ref

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

Definition at line 808 of file gc.c.

◆ OLD_SYM

#define OLD_SYM (   s)    gc_stat_compat_symbols[gc_stat_compat_sym_##s]

◆ OPT

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

◆ POP_MARK_FUNC_DATA

#define POP_MARK_FUNC_DATA ( )    objspace->mark_func_data = prev_mark_func_data;} while (0)

Definition at line 926 of file gc.c.

◆ PREVENT_STACK_OVERFLOW

#define PREVENT_STACK_OVERFLOW   1

Definition at line 4016 of file gc.c.

◆ PRINT_ENTER_EXIT_TICK

#define PRINT_ENTER_EXIT_TICK   0

Definition at line 155 of file gc.c.

◆ PRINT_MEASURE_LINE

#define PRINT_MEASURE_LINE   0

Definition at line 152 of file gc.c.

◆ PRINT_ROOT_TICKS

#define PRINT_ROOT_TICKS   0

Definition at line 158 of file gc.c.

◆ PROFILE_REMEMBERSET_MARK

#define PROFILE_REMEMBERSET_MARK   0

Definition at line 5818 of file gc.c.

◆ PUSH_MARK_FUNC_DATA

#define PUSH_MARK_FUNC_DATA (   v)
Value:
do { \
struct mark_func_data_struct *prev_mark_func_data = objspace->mark_func_data; \
objspace->mark_func_data = (v);

Definition at line 922 of file gc.c.

◆ RANY

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

Definition at line 817 of file gc.c.

Referenced by rb_obj_info_dump().

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

◆ rb_objspace

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

◆ rb_objspace_of

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

Definition at line 730 of file gc.c.

Referenced by rb_memerror(), and rb_threadptr_during_gc().

◆ rb_setjmp

#define rb_setjmp (   env)    RUBY_SETJMP(env)

Definition at line 90 of file gc.c.

◆ RESTORE_FINALIZER

#define RESTORE_FINALIZER ( )
Value:
(\
th->ec.cfp = saved.cfp, \
rb_set_safe_level_force(saved.safe), \
rb_set_errinfo(saved.errinfo))

◆ RGENGC_CHECK_MODE

#define RGENGC_CHECK_MODE   0

Definition at line 246 of file gc.c.

Referenced by rb_gc_writebarrier().

◆ RGENGC_DEBUG

#define RGENGC_DEBUG   0

Definition at line 227 of file gc.c.

◆ RGENGC_DEBUG_ENABLED

#define RGENGC_DEBUG_ENABLED (   level)    ((RGENGC_DEBUG) >= (level))

Definition at line 233 of file gc.c.

◆ RGENGC_ESTIMATE_OLDMALLOC

#define RGENGC_ESTIMATE_OLDMALLOC   1

Definition at line 281 of file gc.c.

◆ RGENGC_FORCE_MAJOR_GC

#define RGENGC_FORCE_MAJOR_GC   0

Definition at line 288 of file gc.c.

◆ RGENGC_OBJ_INFO

#define RGENGC_OBJ_INFO   (RGENGC_DEBUG | RGENGC_CHECK_MODE)

Definition at line 338 of file gc.c.

◆ RGENGC_OLD_NEWOBJ_CHECK

#define RGENGC_OLD_NEWOBJ_CHECK   0

Definition at line 262 of file gc.c.

◆ RGENGC_PROFILE

#define RGENGC_PROFILE   0

Definition at line 271 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 8735 of file gc.c.

◆ ruby_gc_stress_mode

#define ruby_gc_stress_mode   objspace->gc_stress_mode

Definition at line 760 of file gc.c.

◆ ruby_gc_stressful

#define ruby_gc_stressful   objspace->flags.gc_stressful

Definition at line 759 of file gc.c.

◆ ruby_initial_gc_stress

#define ruby_initial_gc_stress   gc_params.gc_stress

Definition at line 736 of file gc.c.

◆ RVALUE_AGE_SHIFT

#define RVALUE_AGE_SHIFT   5 /* FL_PROMOTED0 bit */

Definition at line 1047 of file gc.c.

◆ RVALUE_MARK_BITMAP

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

Definition at line 1034 of file gc.c.

◆ RVALUE_MARKING_BITMAP

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

Definition at line 1040 of file gc.c.

◆ RVALUE_OLD_AGE

#define RVALUE_OLD_AGE   3

Definition at line 1046 of file gc.c.

◆ RVALUE_PAGE_MARKED

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

Definition at line 1035 of file gc.c.

◆ RVALUE_PAGE_MARKING

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

Definition at line 1044 of file gc.c.

◆ RVALUE_PAGE_UNCOLLECTIBLE

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

Definition at line 1043 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 1042 of file gc.c.

◆ RVALUE_UNCOLLECTIBLE_BITMAP

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

Definition at line 1039 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 1038 of file gc.c.

◆ RZOMBIE

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

Definition at line 826 of file gc.c.

◆ S [1/3]

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

Referenced by ruby_dtoa().

◆ S [2/3]

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

◆ S [3/3]

#define S (   s)    gc_stat_compat_symbols[gc_stat_compat_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));
#define Qnil
Definition: ruby.h:438
const char * name
Definition: nkf.c:208

◆ 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));
#define Qnil
Definition: ruby.h:438
const char * name
Definition: nkf.c:208
#define SIZET2NUM(v)
Definition: ruby.h:264

◆ SET_STACK_END

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

Definition at line 3979 of file gc.c.

Referenced by ruby_stack_length().

◆ STACK_CHUNK_SIZE

#define STACK_CHUNK_SIZE   500

Definition at line 482 of file gc.c.

◆ STACK_END

#define STACK_END   (ec->machine.stack_end)

Definition at line 3983 of file gc.c.

Referenced by ruby_stack_length().

◆ STACK_LENGTH

#define STACK_LENGTH
Value:
: (size_t)(STACK_END - STACK_START + 1))
#define STACK_START
Definition: gc.c:3982
#define STACK_END
Definition: gc.c:3983

Definition at line 3991 of file gc.c.

Referenced by ruby_stack_length().

◆ STACK_LEVEL_MAX

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

Definition at line 3984 of file gc.c.

◆ STACK_START

#define STACK_START   (ec->machine.stack_start)

Definition at line 3982 of file gc.c.

Referenced by ruby_stack_length().

◆ STACKFRAME_FOR_CALL_CFUNC

#define STACKFRAME_FOR_CALL_CFUNC   838

Definition at line 4044 of file gc.c.

◆ stress_to_class

#define stress_to_class   0

Definition at line 764 of file gc.c.

◆ TF

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

◆ TICK_TYPE

#define TICK_TYPE   1

Definition at line 162 of file gc.c.

◆ TRY_WITH_GC

#define TRY_WITH_GC (   alloc)
Value:
do { \
objspace_malloc_gc_stress(objspace); \
if (!(alloc) && \
(!garbage_collect_with_gvl(objspace, TRUE, TRUE, TRUE, GPR_FLAG_MALLOC) || /* full/immediate mark && immediate sweep */ \
!(alloc))) { \
ruby_memerror(); \
} \
} while (0)
#define TRUE
Definition: nkf.h:175

Definition at line 7907 of file gc.c.

◆ TYPE_NAME

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

◆ USE_TICK_T

Definition at line 161 of file gc.c.

◆ will_be_incremental_marking

#define will_be_incremental_marking (   objspace)    ((objspace)->rgengc.need_major_gc != GPR_FLAG_NONE)

Definition at line 799 of file gc.c.

◆ WMAP_DELETE_DEAD_OBJECT_IN_MARK

#define WMAP_DELETE_DEAD_OBJECT_IN_MARK   0

Definition at line 8212 of file gc.c.

Typedef Documentation

◆ bits_t

typedef uintptr_t bits_t

Definition at line 461 of file gc.c.

◆ each_obj_callback

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

Definition at line 2408 of file gc.c.

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

◆ anonymous enum

anonymous enum
Enumerator
HEAP_PAGE_ALIGN 
HEAP_PAGE_ALIGN_MASK 
REQUIRED_SIZE_BY_MALLOC 
HEAP_PAGE_SIZE 
HEAP_PAGE_OBJ_LIMIT 
HEAP_PAGE_BITMAP_LIMIT 
HEAP_PAGE_BITMAP_SIZE 
HEAP_PAGE_BITMAP_PLANES 

Definition at line 666 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 6283 of file gc.c.

◆ gc_mode

enum gc_mode
Enumerator
gc_mode_none 
gc_mode_marking 
gc_mode_sweeping 

Definition at line 512 of file gc.c.

◆ 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_BY_OLDMALLOC 
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 

Definition at line 341 of file gc.c.

◆ gc_stat_compat_sym

Enumerator
gc_stat_compat_sym_gc_stat_heap_used 
gc_stat_compat_sym_heap_eden_page_length 
gc_stat_compat_sym_heap_tomb_page_length 
gc_stat_compat_sym_heap_increment 
gc_stat_compat_sym_heap_length 
gc_stat_compat_sym_heap_live_slot 
gc_stat_compat_sym_heap_free_slot 
gc_stat_compat_sym_heap_final_slot 
gc_stat_compat_sym_heap_swept_slot 
gc_stat_compat_sym_remembered_shady_object 
gc_stat_compat_sym_remembered_shady_object_limit 
gc_stat_compat_sym_old_object 
gc_stat_compat_sym_old_object_limit 
gc_stat_compat_sym_total_allocated_object 
gc_stat_compat_sym_total_freed_object 
gc_stat_compat_sym_malloc_increase 
gc_stat_compat_sym_malloc_limit 
gc_stat_compat_sym_oldmalloc_increase 
gc_stat_compat_sym_oldmalloc_limit 
gc_stat_compat_sym_last 

Definition at line 6956 of file gc.c.

◆ 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_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_oldmalloc_increase_bytes 
gc_stat_sym_oldmalloc_increase_bytes_limit 
gc_stat_sym_last 

Definition at line 6915 of file gc.c.

◆ memop_type

enum memop_type
Enumerator
MEMOP_TYPE_MALLOC 
MEMOP_TYPE_FREE 
MEMOP_TYPE_REALLOC 

Definition at line 7783 of file gc.c.

Function Documentation

◆ Init_GC()

void Init_GC ( void  )

Definition at line 9604 of file gc.c.

References rb_define_module(), and rb_define_singleton_method().

◆ Init_heap()

void Init_heap ( void  )

Definition at line 2381 of file gc.c.

References rb_objspace.

Referenced by ruby_setup().

◆ Init_stack()

void Init_stack ( volatile VALUE addr)

Definition at line 6659 of file gc.c.

References ruby_init_stack().

◆ NOINLINE() [1/3]

NOINLINE ( static VALUE   newobj_slowpath_wb_protectedVALUE klass, VALUE flags, VALUE v1, VALUE v2, VALUE v3, rb_objspace_t *objspace)

◆ NOINLINE() [2/3]

NOINLINE ( static void   gc_mark_ptrrb_objspace_t *objspace, VALUE obj)

◆ NOINLINE() [3/3]

NOINLINE ( static void   gc_writebarrier_generationalVALUE a, VALUE b, rb_objspace_t *objspace)

◆ PRINTF_ARGS()

PRINTF_ARGS ( static void   gc_report_bodyint level, rb_objspace_t *objspace, const char *fmt,...,
,
 
)

◆ PUREFUNC()

PUREFUNC ( static inline int   is_id_valuerb_objspace_t *objspace, VALUE ptr)

◆ rb_alloc_tmp_buffer()

void* rb_alloc_tmp_buffer ( volatile VALUE store,
long  len 
)

Definition at line 8136 of file gc.c.

References cnt, 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 8120 of file gc.c.

References imemo_alloc, and rb_imemo_new().

Referenced by rb_alloc_tmp_buffer().

◆ rb_copy_wb_protected_attribute()

void rb_copy_wb_protected_attribute ( VALUE  dest,
VALUE  obj 
)

Definition at line 6104 of file gc.c.

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

References Check_Type, and T_CLASS.

Referenced by RUBY_ALIAS_FUNCTION().

◆ rb_data_typed_object_wrap()

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

Definition at line 2058 of file gc.c.

References Check_Type, and T_CLASS.

Referenced by RUBY_ALIAS_FUNCTION().

◆ rb_define_finalizer()

VALUE rb_define_finalizer ( VALUE  obj,
VALUE  block 
)

Definition at line 2748 of file gc.c.

◆ rb_during_gc()

int rb_during_gc ( void  )

Definition at line 6735 of file gc.c.

References during_gc, and rb_objspace.

Referenced by rb_threadptr_stack_overflow().

◆ rb_free_const_table()

void rb_free_const_table ( struct rb_id_table tbl)

Definition at line 2140 of file gc.c.

References rb_id_table_foreach_values().

◆ rb_free_tmp_buffer()

void rb_free_tmp_buffer ( volatile VALUE store)

◆ rb_garbage_collect()

int rb_garbage_collect ( void  )

Definition at line 6651 of file gc.c.

◆ rb_gc()

void rb_gc ( void  )

Definition at line 6727 of file gc.c.

References rb_objspace.

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

◆ rb_gc_adjust_memory_usage()

void rb_gc_adjust_memory_usage ( ssize_t  diff)

Definition at line 8191 of file gc.c.

◆ rb_gc_call_finalizer_at_exit()

void rb_gc_call_finalizer_at_exit ( void  )

Definition at line 2908 of file gc.c.

◆ rb_gc_copy_finalizer()

void rb_gc_copy_finalizer ( VALUE  dest,
VALUE  obj 
)

Definition at line 2756 of file gc.c.

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

◆ rb_gc_count()

size_t rb_gc_count ( void  )

Definition at line 6766 of file gc.c.

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

◆ rb_gc_disable()

VALUE rb_gc_disable ( void  )

Definition at line 7389 of file gc.c.

References dont_gc, and rb_objspace.

◆ rb_gc_enable()

VALUE rb_gc_enable ( void  )

Definition at line 7367 of file gc.c.

References dont_gc, FALSE, Qfalse, Qtrue, and rb_objspace.

◆ rb_gc_finalize_deferred()

void rb_gc_finalize_deferred ( void  )

Definition at line 2876 of file gc.c.

◆ rb_gc_force_recycle()

void rb_gc_force_recycle ( VALUE  obj)

Definition at line 6175 of file gc.c.

References rb_objspace.

Referenced by rb_parser_free(), and rb_str_tmp_frozen_release().

◆ rb_gc_guarded_ptr_val()

volatile VALUE* rb_gc_guarded_ptr_val ( volatile VALUE ptr,
VALUE  val 
)

Definition at line 97 of file gc.c.

References rb_gc_guarded_val, and val.

◆ rb_gc_latest_gc_info()

VALUE rb_gc_latest_gc_info ( VALUE  key)

Definition at line 6881 of file gc.c.

References rb_objspace.

◆ rb_gc_mark()

void rb_gc_mark ( VALUE  ptr)

◆ rb_gc_mark_locations()

void rb_gc_mark_locations ( const VALUE start,
const VALUE end 
)

Definition at line 4081 of file gc.c.

◆ rb_gc_mark_machine_stack()

void rb_gc_mark_machine_stack ( const rb_execution_context_t ec)

Definition at line 4274 of file gc.c.

References GET_STACK_BOUNDS, and rb_objspace.

◆ rb_gc_mark_maybe()

void rb_gc_mark_maybe ( VALUE  obj)

Definition at line 4320 of file gc.c.

Referenced by rb_gc_mark_node(), rb_gvar_val_marker(), and rb_gvar_var_marker().

◆ rb_gc_mark_values()

void rb_gc_mark_values ( long  n,
const VALUE values 
)

Definition at line 4097 of file gc.c.

References rb_objspace.

Referenced by rb_execution_context_mark(), and rb_vm_mark().

◆ rb_gc_register_address()

void rb_gc_register_address ( VALUE addr)

Definition at line 6241 of file gc.c.

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

Referenced by rb_global_variable().

◆ rb_gc_register_mark_object()

void rb_gc_register_mark_object ( VALUE  obj)

◆ rb_gc_start()

VALUE rb_gc_start ( void  )

Definition at line 6720 of file gc.c.

References Qnil, and rb_gc().

◆ rb_gc_stat()

size_t rb_gc_stat ( VALUE  key)

Definition at line 7295 of file gc.c.

References SYMBOL_P.

◆ rb_gc_unprotect_logging()

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

Definition at line 6075 of file gc.c.

References st_init_strtable.

◆ rb_gc_unregister_address()

void rb_gc_unregister_address ( VALUE addr)

Definition at line 6253 of file gc.c.

References global_list, gc_list::next, rb_objspace, gc_list::varptr, and xfree().

◆ rb_gc_verify_internal_consistency()

void rb_gc_verify_internal_consistency ( void  )

Definition at line 5379 of file gc.c.

◆ rb_gc_writebarrier()

void rb_gc_writebarrier ( VALUE  a,
VALUE  b 
)

Definition at line 5984 of file gc.c.

References is_incremental_marking, rb_bug(), rb_objspace, RGENGC_CHECK_MODE, and SPECIAL_CONST_P.

◆ rb_gc_writebarrier_remember()

void rb_gc_writebarrier_remember ( VALUE  obj)

Definition at line 6041 of file gc.c.

References gc_report, and rb_objspace.

Referenced by rb_hash_keys(), and rb_hash_values().

◆ rb_gc_writebarrier_unprotect()

void rb_gc_writebarrier_unprotect ( VALUE  obj)

Definition at line 6005 of file gc.c.

◆ rb_gcdebug_print_obj_condition()

void rb_gcdebug_print_obj_condition ( VALUE  obj)

Referenced by rb_obj_info_dump().

◆ rb_global_variable()

void rb_global_variable ( VALUE var)

Definition at line 6276 of file gc.c.

References rb_gc_register_address().

Referenced by Init_openssl().

◆ rb_imemo_new()

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

Definition at line 2020 of file gc.c.

References FL_USHIFT, and T_IMEMO.

Referenced by rb_alloc_tmp_buffer_with_count().

◆ rb_iseq_free()

void rb_iseq_free ( const rb_iseq_t iseq)

◆ rb_iseq_mark()

void rb_iseq_mark ( const rb_iseq_t iseq)

◆ rb_mark_hash()

void rb_mark_hash ( st_table tbl)

Definition at line 4157 of file gc.c.

◆ rb_mark_set()

void rb_mark_set ( st_table tbl)

Definition at line 4134 of file gc.c.

◆ rb_mark_tbl()

void rb_mark_tbl ( st_table tbl)

Definition at line 4302 of file gc.c.

Referenced by rb_vm_mark().

◆ rb_memerror()

void rb_memerror ( void  )

Definition at line 7700 of file gc.c.

References during_gc, GET_THREAD, rb_objspace_of, and rb_thread_struct::vm.

◆ rb_newobj()

VALUE rb_newobj ( void  )

Definition at line 1998 of file gc.c.

◆ rb_newobj_of()

VALUE rb_newobj_of ( VALUE  klass,
VALUE  flags 
)

Definition at line 2004 of file gc.c.

◆ rb_node_newnode()

NODE* rb_node_newnode ( enum node_type  type,
VALUE  a0,
VALUE  a1,
VALUE  a2 
)

Definition at line 2010 of file gc.c.

◆ rb_obj_gc_flags()

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

Definition at line 6142 of file gc.c.

◆ rb_obj_id()

VALUE rb_obj_id ( VALUE  obj)

◆ rb_obj_info()

const char* rb_obj_info ( VALUE  obj)

Definition at line 9442 of file gc.c.

◆ rb_obj_info_dump()

void rb_obj_info_dump ( VALUE  obj)

Definition at line 9453 of file gc.c.

References RANY, rb_gcdebug_print_obj_condition(), rb_objspace, and rb_raw_obj_info().

◆ rb_obj_memsize_of()

size_t rb_obj_memsize_of ( VALUE  obj)

Definition at line 3327 of file gc.c.

◆ rb_obj_rgengc_promoted_p()

VALUE rb_obj_rgengc_promoted_p ( VALUE  obj)

Definition at line 6136 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 6126 of file gc.c.

◆ rb_objspace_alloc()

rb_objspace_t* rb_objspace_alloc ( void  )

Definition at line 1327 of file gc.c.

References calloc, malloc_limit, ruby_gc_params_t::malloc_limit_min, and rb_objspace.

◆ rb_objspace_data_type_memsize()

size_t rb_objspace_data_type_memsize ( VALUE  obj)

◆ rb_objspace_data_type_name()

const char* rb_objspace_data_type_name ( VALUE  obj)

Definition at line 2091 of file gc.c.

References PUREFUNC(), RTYPEDDATA_P, and RTYPEDDATA_TYPE.

◆ rb_objspace_each_objects()

void rb_objspace_each_objects ( each_obj_callback callback,
void *  data 
)

Definition at line 2489 of file gc.c.

◆ rb_objspace_each_objects_without_setup()

void rb_objspace_each_objects_without_setup ( each_obj_callback callback,
void *  data 
)

Definition at line 2510 of file gc.c.

◆ rb_objspace_free()

void rb_objspace_free ( rb_objspace_t objspace)

◆ rb_objspace_garbage_object_p()

int rb_objspace_garbage_object_p ( VALUE  obj)

Definition at line 3072 of file gc.c.

References rb_objspace.

◆ rb_objspace_internal_object_p()

int rb_objspace_internal_object_p ( VALUE  obj)

Definition at line 2552 of file gc.c.

◆ rb_objspace_markable_object_p()

int rb_objspace_markable_object_p ( VALUE  obj)

Definition at line 3065 of file gc.c.

References rb_objspace.

◆ rb_objspace_marked_object_p()

int rb_objspace_marked_object_p ( VALUE  obj)

Definition at line 4474 of file gc.c.

◆ rb_objspace_reachable_objects_from()

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

Definition at line 7599 of file gc.c.

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

References root_objects_data::data, root_objects_data::func, and rb_objspace.

◆ rb_objspace_set_event_hook()

void rb_objspace_set_event_hook ( const rb_event_flag_t  event)

◆ rb_raw_obj_info()

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

Definition at line 9290 of file gc.c.

References snprintf, and SPECIAL_CONST_P.

Referenced by rb_obj_info_dump(), and ruby_debug_print_value().

◆ rb_threadptr_during_gc()

int rb_threadptr_during_gc ( rb_thread_t th)

Definition at line 6742 of file gc.c.

References during_gc, rb_objspace_of, and rb_thread_struct::vm.

◆ rb_threadptr_stack_check()

int rb_threadptr_stack_check ( rb_thread_t th)

Definition at line 4047 of file gc.c.

◆ rb_undefine_finalizer()

VALUE rb_undefine_finalizer ( VALUE  obj)

Definition at line 2653 of file gc.c.

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

◆ rb_wb_protected_newobj_of()

VALUE rb_wb_protected_newobj_of ( VALUE  klass,
VALUE  flags 
)

Definition at line 1989 of file gc.c.

References FL_WB_PROTECTED, and GC_ASSERT.

◆ rb_wb_unprotected_newobj_of()

VALUE rb_wb_unprotected_newobj_of ( VALUE  klass,
VALUE  flags 
)

Definition at line 1982 of file gc.c.

References FL_WB_PROTECTED, and GC_ASSERT.

◆ RUBY_ALIAS_FUNCTION() [1/2]

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

Definition at line 2044 of file gc.c.

References DATA_PTR, rb_data_object_wrap(), and xcalloc.

◆ RUBY_ALIAS_FUNCTION() [2/2]

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

Definition at line 2065 of file gc.c.

References DATA_PTR, rb_data_typed_object_wrap(), and xcalloc.

◆ ruby_gc_set_params()

void ruby_gc_set_params ( int  safe_level)

Definition at line 7553 of file gc.c.

◆ ruby_get_stack_grow_direction()

int ruby_get_stack_grow_direction ( volatile VALUE addr)

Definition at line 3997 of file gc.c.

References SET_MACHINE_STACK_END.

◆ ruby_malloc_size_overflow()

void ruby_malloc_size_overflow ( size_t  count,
size_t  elsize 
)

Definition at line 8006 of file gc.c.

References PRIuSIZE, rb_eArgError, and rb_raise().

◆ ruby_mimfree()

void ruby_mimfree ( void *  ptr)

Definition at line 8110 of file gc.c.

References free().

◆ ruby_mimmalloc()

void* ruby_mimmalloc ( size_t  size)

Definition at line 8094 of file gc.c.

References malloc.

Referenced by Init_BareVM().

◆ ruby_sized_xfree()

void ruby_sized_xfree ( void *  x,
size_t  size 
)

Definition at line 8077 of file gc.c.

Referenced by rb_ary_free(), rb_str_free(), and ruby_xfree().

◆ ruby_sized_xrealloc()

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

Definition at line 8039 of file gc.c.

Referenced by ruby_xrealloc().

◆ ruby_sized_xrealloc2()

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

Definition at line 8058 of file gc.c.

References len, rb_eArgError, and rb_raise().

Referenced by ruby_xrealloc2().

◆ ruby_xcalloc()

void* ruby_xcalloc ( size_t  n,
size_t  size 
)

Definition at line 8030 of file gc.c.

Referenced by rb_iseq_defined_string().

◆ ruby_xfree()

void ruby_xfree ( void *  x)

◆ ruby_xmalloc()

void* ruby_xmalloc ( size_t  size)

Definition at line 7997 of file gc.c.

◆ ruby_xmalloc2()

void* ruby_xmalloc2 ( size_t  n,
size_t  size 
)

Definition at line 8014 of file gc.c.

◆ ruby_xrealloc()

void* ruby_xrealloc ( void *  ptr,
size_t  new_size 
)

Definition at line 8049 of file gc.c.

References ruby_sized_xrealloc().

◆ ruby_xrealloc2()

void* ruby_xrealloc2 ( void *  ptr,
size_t  n,
size_t  size 
)

Definition at line 8068 of file gc.c.

References ruby_sized_xrealloc2().

Variable Documentation

◆ rb_gc_guarded_val

volatile VALUE rb_gc_guarded_val

Definition at line 95 of file gc.c.

Referenced by rb_gc_guarded_ptr_val().

◆ rb_mGC

VALUE rb_mGC

Definition at line 831 of file gc.c.

◆ ruby_disable_gc

int ruby_disable_gc = 0

Definition at line 832 of file gc.c.

◆ ruby_gc_debug_indent

int ruby_gc_debug_indent = 0

Definition at line 830 of file gc.c.

◆ ruby_initial_gc_stress_ptr

VALUE* ruby_initial_gc_stress_ptr = &ruby_initial_gc_stress

Definition at line 738 of file gc.c.

Referenced by ruby_env_debug_option().

◆ ruby_rgengc_debug

int ruby_rgengc_debug

Definition at line 235 of file gc.c.

Referenced by ruby_debug_breakpoint(), and ruby_env_debug_option().

◆ ruby_stack_grow_direction

int ruby_stack_grow_direction

Definition at line 3995 of file gc.c.