Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
class method
GC.add_stress_to_class
GC.add_stress_to_class(class[, ...])
gc/default/default.c
View on GitHub ↗
static VALUE
rb_gcdebug_add_stress_to_class(int argc, VALUE *argv, VALUE self)
{
rb_objspace_t *objspace = rb_gc_get_objspace();
if (!stress_to_class) {
set_stress_to_class(rb_ident_hash_new_capa(argc));
}
for (int i = 0; i < argc; i++) {
VALUE klass = argv[i];
rb_hash_aset(stress_to_class, klass, Qtrue);
}
return self;
}
Raises NoMemoryError when allocating an instance of the given classes.