Ruby 3.1.3p185 (2022-11-24 revision 1a6b16756e0ba6b95ab71a441357ed5484e33498)
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#if 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
198VALUE rb_gc_location(VALUE obj);
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
317VALUE rb_define_finalizer(VALUE obj, VALUE block);
318
330VALUE rb_undefine_finalizer(VALUE obj);
331
337size_t rb_gc_count(void);
338
355size_t rb_gc_stat(VALUE key_or_buf);
356
374VALUE rb_gc_latest_gc_info(VALUE key_or_buf);
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:32
#define RBIMPL_ATTR_DEPRECATED(msg)
Wraps (or simulates) [[deprecated]]
Definition: deprecated.h:36
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:6774
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:6561
void rb_memerror(void)
Triggers out-of-memory error.
Definition: gc.c:11114
size_t rb_gc_stat(VALUE key_or_buf)
Obtains various GC related profiles.
Definition: gc.c:10651
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:6768
VALUE rb_gc_disable(void)
Disables GC.
Definition: gc.c:10723
VALUE rb_gc_start(void)
Identical to rb_gc(), except the return value.
Definition: gc.c:10285
VALUE rb_gc_latest_gc_info(VALUE key_or_buf)
Obtains various info regarding the most recent GC run.
Definition: gc.c:10429
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:6555
VALUE rb_gc_enable(void)
(Re-) enables GC.
Definition: gc.c:10686
void rb_mark_hash(struct st_table *tbl)
Marks keys and values associated inside of the given table.
Definition: gc.c:6378
VALUE rb_undefine_finalizer(VALUE obj)
Modifies the object so that it has no finalisers at all.
Definition: gc.c:3785
int rb_during_gc(void)
Queries if the GC is busy.
Definition: gc.c:10300
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:6593
VALUE rb_gc_location(VALUE obj)
Finds a new "location" of an object.
Definition: gc.c:9753
void rb_gc_mark_locations(const VALUE *start, const VALUE *end)
Marks objects between the two pointers.
Definition: gc.c:6208
void rb_gc(void)
Triggers a GC process.
Definition: gc.c:10292
void rb_gc_force_recycle(VALUE obj)
Asserts that the passed object is no longer needed.
Definition: gc.c:8676
void rb_gc_update_tbl_refs(st_table *ptr)
Updates references inside of tables.
Definition: gc.c:9597
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:6314
VALUE rb_define_finalizer(VALUE obj, VALUE block)
Assigns a finaliser for an object.
Definition: gc.c:3937
void rb_gc_copy_finalizer(VALUE dst, VALUE src)
Copy&paste an object's finaliser to another.
Definition: gc.c:3945
void rb_gc_adjust_memory_usage(ssize_t diff)
Informs that there are external memory usages.
Definition: gc.c:11920
size_t rb_gc_count(void)
Identical to rb_gc_stat(), with "count" parameter.
Definition: gc.c:10324
RBIMPL_ATTR_NORETURN() void rb_eof_error(void)
Utility function to raise rb_eEOFError.
RBIMPL_ATTR_PURE() int rb_io_read_pending(rb_io_t *fptr)
Queries if the passed IO has any pending reads.
Defines RBIMPL_ATTR_NONNULL.
#define RBIMPL_ATTR_NONNULL(list)
Wraps (or simulates) __attribute__((nonnull))
Definition: nonnull.h:27
Defines RBIMPL_ATTR_NORETURN.
Defines RBIMPL_ATTR_PURE.
Defines VALUE and ID.