Module: GC
- Defined in:
- gc.c
Overview
The GC
module provides an interface to Ruby’s mark and sweep garbage collection mechanism. Some of the underlying methods are also available via the ObjectSpace
module.
Class Method Summary collapse
-
.disable ⇒ Boolean
Disables garbage collection, returning
true
if garbage collection was already disabled. -
.enable ⇒ Boolean
Enables garbage collection, returning
true
if garbage collection was previously disabled. -
.start ⇒ Object
Initiates garbage collection, unless manually disabled.
-
.stress ⇒ Boolean
returns current status of GC stress mode.
-
.stress=(bool) ⇒ Boolean
updates GC stress mode.
Instance Method Summary collapse
-
#garbage_collect ⇒ Object
Initiates garbage collection, unless manually disabled.
Class Method Details
.disable ⇒ Boolean
243 244 245 246 247 248 249 250 |
# File 'gc.c', line 243
VALUE
rb_gc_disable()
{
int old = dont_gc;
dont_gc = Qtrue;
return old;
}
|
.enable ⇒ Boolean
222 223 224 225 226 227 228 229 |
# File 'gc.c', line 222
VALUE
rb_gc_enable()
{
int old = dont_gc;
dont_gc = Qfalse;
return old;
}
|
.start ⇒ nil .garbage_collect ⇒ nil .garbage_collect ⇒ nil
Initiates garbage collection, unless manually disabled.
1458 1459 1460 1461 1462 1463 |
# File 'gc.c', line 1458
VALUE
rb_gc_start()
{
rb_gc();
return Qnil;
}
|
.stress ⇒ Boolean
returns current status of GC stress mode.
101 102 103 |
# File 'gc.c', line 101 static VALUE gc_stress_get(self) VALUE self; |
.stress=(bool) ⇒ Boolean
updates GC stress mode.
When GC.stress = true, GC is invoked for all GC opportunity: all memory and object allocation.
Since it makes Ruby very slow, it is only for debugging.
120 121 122 |
# File 'gc.c', line 120 static VALUE gc_stress_set(self, bool) VALUE self, bool; |
Instance Method Details
#start ⇒ nil #garbage_collect ⇒ nil #garbage_collect ⇒ nil
Initiates garbage collection, unless manually disabled.
1458 1459 1460 1461 1462 1463 |
# File 'gc.c', line 1458
VALUE
rb_gc_start()
{
rb_gc();
return Qnil;
}
|