Ruby 3.2.2p53 (2023-03-30 revision e51014f9c05aa65cbf203442d37fef7c12390015)
gc.h
Go to the documentation of this file.
1#ifndef RBIMPL_INTERN_GC_H /*-*-C++-*-vi:se ft=cpp:*/
2#define RBIMPL_INTERN_GC_H
23#include "ruby/internal/config.h"
24
25#ifdef STDC_HEADERS
26# include <stddef.h> /* size_t */
27#endif
28
29#ifdef HAVE_SYS_TYPES_H
30# include <sys/types.h> /* ssize_t */
31#endif
32
38#include "ruby/internal/value.h"
39
41
42/* gc.c */
43
53void rb_memerror(void);
54
62int rb_during_gc(void);
63
80void rb_gc_mark_locations(const VALUE *start, const VALUE *end);
81
92void rb_mark_tbl(struct st_table *tbl);
93
103void rb_mark_tbl_no_pin(struct st_table *tbl);
104
115void rb_mark_set(struct st_table *tbl);
116
125void rb_mark_hash(struct st_table *tbl);
126
137
148void rb_gc_mark_maybe(VALUE obj);
149
157void rb_gc_mark(VALUE obj);
158
187void rb_gc_mark_movable(VALUE obj);
188
199
213RBIMPL_ATTR_DEPRECATED(("this is now a no-op function"))
214void rb_gc_force_recycle(VALUE obj);
215
241void rb_gc(void);
242
257void rb_gc_copy_finalizer(VALUE dst, VALUE src);
258
271VALUE rb_gc_enable(void);
272
288VALUE rb_gc_disable(void);
289
295VALUE rb_gc_start(void);
296
318
331
337size_t rb_gc_count(void);
338
355size_t rb_gc_stat(VALUE key_or_buf);
356
375
388void rb_gc_adjust_memory_usage(ssize_t diff);
389
391
392#endif /* RBIMPL_INTERN_GC_H */
Defines RBIMPL_ATTR_COLD.
#define RBIMPL_ATTR_COLD()
Wraps (or simulates) __attribute__((cold))
Definition cold.h:34
#define RBIMPL_ATTR_DEPRECATED(msg)
Wraps (or simulates) [[deprecated]]
Definition deprecated.h:64
Tweaking visibility of C variables/functions.
#define RBIMPL_SYMBOL_EXPORT_END()
Counterpart of RBIMPL_SYMBOL_EXPORT_BEGIN.
Definition dllexport.h:106
#define RBIMPL_SYMBOL_EXPORT_BEGIN()
Shortcut macro equivalent to RUBY_SYMBOL_EXPORT_BEGIN extern "C" {.
Definition dllexport.h:97
void rb_gc_mark(VALUE obj)
Marks an object.
Definition gc.c:7102
void rb_mark_tbl_no_pin(struct st_table *tbl)
Identical to rb_mark_tbl(), except it marks objects using rb_gc_mark_movable().
Definition gc.c:6890
void rb_memerror(void)
Triggers out-of-memory error.
Definition gc.c:11981
size_t rb_gc_stat(VALUE key_or_buf)
Obtains various GC related profiles.
Definition gc.c:11362
void rb_gc_mark_movable(VALUE obj)
Maybe this is the only function provided for C extensions to control the pinning of objects,...
Definition gc.c:7096
VALUE rb_gc_disable(void)
Disables GC.
Definition gc.c:11565
VALUE rb_gc_start(void)
Identical to rb_gc(), except the return value.
Definition gc.c:10981
VALUE rb_gc_latest_gc_info(VALUE key_or_buf)
Obtains various info regarding the most recent GC run.
Definition gc.c:11140
void rb_mark_tbl(struct st_table *tbl)
Identical to rb_mark_hash(), except it marks only values of the table and leave their associated keys...
Definition gc.c:6884
VALUE rb_gc_enable(void)
(Re-) enables GC.
Definition gc.c:11528
void rb_mark_hash(struct st_table *tbl)
Marks keys and values associated inside of the given table.
Definition gc.c:6687
VALUE rb_undefine_finalizer(VALUE obj)
Modifies the object so that it has no finalisers at all.
Definition gc.c:4154
int rb_during_gc(void)
Queries if the GC is busy.
Definition gc.c:10996
void rb_gc_mark_maybe(VALUE obj)
Identical to rb_gc_mark(), except it allows the passed value be a non-object.
Definition gc.c:6921
VALUE rb_gc_location(VALUE obj)
Finds a new "location" of an object.
Definition gc.c:10384
void rb_gc_mark_locations(const VALUE *start, const VALUE *end)
Marks objects between the two pointers.
Definition gc.c:6517
void rb_gc(void)
Triggers a GC process.
Definition gc.c:10988
void rb_gc_force_recycle(VALUE obj)
Asserts that the passed object is no longer needed.
Definition gc.c:9234
void rb_gc_update_tbl_refs(st_table *ptr)
Updates references inside of tables.
Definition gc.c:10228
void rb_mark_set(struct st_table *tbl)
Identical to rb_mark_hash(), except it marks only keys of the table and leave their associated values...
Definition gc.c:6623
VALUE rb_define_finalizer(VALUE obj, VALUE block)
Assigns a finaliser for an object.
Definition gc.c:4306
void rb_gc_copy_finalizer(VALUE dst, VALUE src)
Copy&paste an object's finaliser to another.
Definition gc.c:4314
void rb_gc_adjust_memory_usage(ssize_t diff)
Informs that there are external memory usages.
Definition gc.c:12778
size_t rb_gc_count(void)
Identical to rb_gc_stat(), with "count" parameter.
Definition gc.c:11020
Defines RBIMPL_ATTR_NONNULL.
#define RBIMPL_ATTR_NONNULL(list)
Wraps (or simulates) __attribute__((nonnull))
Definition nonnull.h:30
Defines RBIMPL_ATTR_NORETURN.
#define RBIMPL_ATTR_NORETURN()
Wraps (or simulates) [[noreturn]]
Definition noreturn.h:38
Defines RBIMPL_ATTR_PURE.
#define RBIMPL_ATTR_PURE()
Wraps (or simulates) __attribute__((pure))
Definition pure.h:33
Definition st.h:79
Defines VALUE and ID.
uintptr_t VALUE
Type that represents a Ruby object.
Definition value.h:40