Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →
class method
GC.malloc_allocated_size
GC.malloc_allocated_size → Integer
gc/default/default.c
View on GitHub ↗
static VALUE
gc_malloc_allocated_size(VALUE self)
{
rb_objspace_t *objspace = (rb_objspace_t *)rb_gc_get_objspace();
return ULL2NUM(objspace->malloc_params.allocated_size);
}
Returns the size of memory allocated by malloc().
Only available if ruby was built with CALC_EXACT_MALLOC_SIZE.
See also
.latest_gc_info
.malloc_allocations
.latest_compact_info
.measure_total_time
also in
3.3 · 3.2 · 3.1 · 3.0