Ruby  3.3.0dev (2023-02-28 revision 526111290b2e01e798f436dfe4acc3bf10c6bbd1)
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 
53 void rb_memerror(void);
54 
62 int rb_during_gc(void);
63 
80 void rb_gc_mark_locations(const VALUE *start, const VALUE *end);
81 
92 void rb_mark_tbl(struct st_table *tbl);
93 
103 void rb_mark_tbl_no_pin(struct st_table *tbl);
104 
115 void rb_mark_set(struct st_table *tbl);
116 
125 void rb_mark_hash(struct st_table *tbl);
126 
137 
148 void rb_gc_mark_maybe(VALUE obj);
149 
157 void rb_gc_mark(VALUE obj);
158 
187 void rb_gc_mark_movable(VALUE obj);
188 
199 
213 RBIMPL_ATTR_DEPRECATED(("this is now a no-op function"))
214 void rb_gc_force_recycle(VALUE obj);
215 
241 void rb_gc(void);
242 
257 void 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 
318 
331 
337 size_t rb_gc_count(void);
338 
355 size_t rb_gc_stat(VALUE key_or_buf);
356 
374 VALUE rb_gc_latest_gc_info(VALUE key_or_buf);
375 
388 void 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:7149
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:6937
void rb_memerror(void)
Triggers out-of-memory error.
Definition: gc.c:12056
size_t rb_gc_stat(VALUE key_or_buf)
Obtains various GC related profiles.
Definition: gc.c:11421
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:7143
VALUE rb_gc_disable(void)
Disables GC.
Definition: gc.c:11624
VALUE rb_gc_start(void)
Identical to rb_gc(), except the return value.
Definition: gc.c:11028
VALUE rb_gc_latest_gc_info(VALUE key_or_buf)
Obtains various info regarding the most recent GC run.
Definition: gc.c:11187
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:6931
VALUE rb_gc_enable(void)
(Re-) enables GC.
Definition: gc.c:11587
void rb_mark_hash(struct st_table *tbl)
Marks keys and values associated inside of the given table.
Definition: gc.c:6734
VALUE rb_undefine_finalizer(VALUE obj)
Modifies the object so that it has no finalisers at all.
Definition: gc.c:4194
int rb_during_gc(void)
Queries if the GC is busy.
Definition: gc.c:11043
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:6968
VALUE rb_gc_location(VALUE obj)
Finds a new "location" of an object.
Definition: gc.c:10420
void rb_gc_mark_locations(const VALUE *start, const VALUE *end)
Marks objects between the two pointers.
Definition: gc.c:6564
void rb_gc(void)
Triggers a GC process.
Definition: gc.c:11035
void rb_gc_force_recycle(VALUE obj)
Asserts that the passed object is no longer needed.
Definition: gc.c:9272
void rb_gc_update_tbl_refs(st_table *ptr)
Updates references inside of tables.
Definition: gc.c:10264
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:6670
VALUE rb_define_finalizer(VALUE obj, VALUE block)
Assigns a finaliser for an object.
Definition: gc.c:4346
void rb_gc_copy_finalizer(VALUE dst, VALUE src)
Copy&paste an object's finaliser to another.
Definition: gc.c:4354
void rb_gc_adjust_memory_usage(ssize_t diff)
Informs that there are external memory usages.
Definition: gc.c:12853
size_t rb_gc_count(void)
Identical to rb_gc_stat(), with "count" parameter.
Definition: gc.c:11067
RBIMPL_ATTR_NORETURN() void rb_eof_error(void)
Utility function to raise rb_eEOFError.
char * ptr
Pointer to the underlying memory region, of at least capa bytes.
Definition: io.h:2
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.
Definition: st.h:79
Defines VALUE and ID.
uintptr_t VALUE
Type that represents a Ruby object.
Definition: value.h:40