Ruby: include/ruby/internal/intern/gc.h Source File

Ruby 3.2.5p208 (2024-07-26 revision 31d0f1a2e7dbfb60731d1f05b868e1d578cda493)

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
33#include "ruby/internal/attr/cold.h"
34#include "ruby/internal/attr/noreturn.h"
35#include "ruby/internal/attr/nonnull.h"
36#include "ruby/internal/attr/pure.h"
37#include "ruby/internal/dllexport.h"
38#include "ruby/internal/value.h"
39
40 RBIMPL_SYMBOL_EXPORT_BEGIN()
41
42/* gc.c */
43
44 RBIMPL_ATTR_COLD()
45 RBIMPL_ATTR_NORETURN()
53void rb_memerror(void);
54
55 RBIMPL_ATTR_PURE()
62int rb_during_gc(void);
63
64 RBIMPL_ATTR_NONNULL((1))
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
136void rb_gc_update_tbl_refs(st_table *ptr);
137
148void rb_gc_mark_maybe(VALUE obj);
149
157void rb_gc_mark(VALUE obj);
158
187void rb_gc_mark_movable(VALUE obj);
188
198 VALUE rb_gc_location(VALUE obj);
199
213 RBIMPL_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
271 VALUE rb_gc_enable(void);
272
288 VALUE rb_gc_disable(void);
289
295 VALUE rb_gc_start(void);
296
317 VALUE rb_define_finalizer(VALUE obj, VALUE block);
318
330 VALUE rb_undefine_finalizer(VALUE obj);
331
337size_t rb_gc_count(void);
338
355size_t rb_gc_stat(VALUE key_or_buf);
356
374 VALUE rb_gc_latest_gc_info(VALUE key_or_buf);
375
388void rb_gc_adjust_memory_usage(ssize_t diff);
389
390 RBIMPL_SYMBOL_EXPORT_END()
391
392#endif /* RBIMPL_INTERN_GC_H */
cold.h
Defines RBIMPL_ATTR_COLD.
RBIMPL_ATTR_COLD
#define RBIMPL_ATTR_COLD()
Wraps (or simulates) __attribute__((cold))
Definition cold.h:34
RBIMPL_ATTR_DEPRECATED
#define RBIMPL_ATTR_DEPRECATED(msg)
Wraps (or simulates) [[deprecated]]
Definition deprecated.h:64
dllexport.h
Tweaking visibility of C variables/functions.
RBIMPL_SYMBOL_EXPORT_END
#define RBIMPL_SYMBOL_EXPORT_END()
Counterpart of RBIMPL_SYMBOL_EXPORT_BEGIN.
Definition dllexport.h:106
RBIMPL_SYMBOL_EXPORT_BEGIN
#define RBIMPL_SYMBOL_EXPORT_BEGIN()
Shortcut macro equivalent to RUBY_SYMBOL_EXPORT_BEGIN extern "C" {.
Definition dllexport.h:97
rb_gc_mark
void rb_gc_mark(VALUE obj)
Marks an object.
Definition gc.c:7113
rb_mark_tbl_no_pin
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:6901
rb_memerror
void rb_memerror(void)
Triggers out-of-memory error.
Definition gc.c:12020
rb_gc_stat
size_t rb_gc_stat(VALUE key_or_buf)
Obtains various GC related profiles.
Definition gc.c:11401
rb_gc_mark_movable
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:7107
rb_gc_disable
VALUE rb_gc_disable(void)
Disables GC.
Definition gc.c:11604
rb_gc_start
VALUE rb_gc_start(void)
Identical to rb_gc(), except the return value.
Definition gc.c:11020
rb_gc_latest_gc_info
VALUE rb_gc_latest_gc_info(VALUE key_or_buf)
Obtains various info regarding the most recent GC run.
Definition gc.c:11179
rb_mark_tbl
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:6895
rb_gc_enable
VALUE rb_gc_enable(void)
(Re-) enables GC.
Definition gc.c:11567
rb_mark_hash
void rb_mark_hash(struct st_table *tbl)
Marks keys and values associated inside of the given table.
Definition gc.c:6698
rb_undefine_finalizer
VALUE rb_undefine_finalizer(VALUE obj)
Modifies the object so that it has no finalisers at all.
Definition gc.c:4161
rb_during_gc
int rb_during_gc(void)
Queries if the GC is busy.
Definition gc.c:11035
rb_gc_mark_maybe
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:6932
rb_gc_location
VALUE rb_gc_location(VALUE obj)
Finds a new "location" of an object.
Definition gc.c:10396
rb_gc_mark_locations
void rb_gc_mark_locations(const VALUE *start, const VALUE *end)
Marks objects between the two pointers.
Definition gc.c:6528
rb_gc
void rb_gc(void)
Triggers a GC process.
Definition gc.c:11027
rb_gc_force_recycle
void rb_gc_force_recycle(VALUE obj)
Asserts that the passed object is no longer needed.
Definition gc.c:9248
rb_gc_update_tbl_refs
void rb_gc_update_tbl_refs(st_table *ptr)
Updates references inside of tables.
Definition gc.c:10240
rb_mark_set
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:6634
rb_define_finalizer
VALUE rb_define_finalizer(VALUE obj, VALUE block)
Assigns a finaliser for an object.
Definition gc.c:4313
rb_gc_copy_finalizer
void rb_gc_copy_finalizer(VALUE dst, VALUE src)
Copy&paste an object's finaliser to another.
Definition gc.c:4321
rb_gc_adjust_memory_usage
void rb_gc_adjust_memory_usage(ssize_t diff)
Informs that there are external memory usages.
Definition gc.c:12825
rb_gc_count
size_t rb_gc_count(void)
Identical to rb_gc_stat(), with "count" parameter.
Definition gc.c:11059
nonnull.h
Defines RBIMPL_ATTR_NONNULL.
RBIMPL_ATTR_NONNULL
#define RBIMPL_ATTR_NONNULL(list)
Wraps (or simulates) __attribute__((nonnull))
Definition nonnull.h:30
noreturn.h
Defines RBIMPL_ATTR_NORETURN.
RBIMPL_ATTR_NORETURN
#define RBIMPL_ATTR_NORETURN()
Wraps (or simulates) [[noreturn]]
Definition noreturn.h:38
pure.h
Defines RBIMPL_ATTR_PURE.
RBIMPL_ATTR_PURE
#define RBIMPL_ATTR_PURE()
Wraps (or simulates) __attribute__((pure))
Definition pure.h:33
st_table
Definition st.h:79
value.h
Defines VALUE and ID.
VALUE
uintptr_t VALUE
Type that represents a Ruby object.
Definition value.h:40