Process.warmup
static VALUE
proc_warmup(VALUE _)
{
RB_VM_LOCKING() {
rb_gc_prepare_heap();
}
return Qtrue;
}
Notify the Ruby virtual machine that the boot sequence is finished, and that now is a good time to optimize the application. This is useful for long running applications.
This method is expected to be called at the end of the application boot. If the application is deployed using a pre-forking model, Process.warmup should be called in the original process before the first fork.
The actual optimizations performed are entirely implementation specific and may change in the future without notice.
On CRuby, Process.warmup:
-
Performs a major
GC. -
Compacts the heap.
-
Promotes all surviving objects to the old generation.
-
Precomputes the coderange of all strings.
-
Frees all empty heap pages and increments the allocatable pages counter by the number of pages freed.
-
Invoke
malloc_trimif available to free empty malloc pages.
Ruby version changes
-
3.3
-
New
Process.warmupmethod that notify the Ruby virtual machine that the boot sequence is finished, and that now is a good time to optimize the application. This is useful for long-running applications. The actual optimizations performed are entirely implementation-specific and may change in the future without notice. [Feature #18885]
-