aboutsummaryrefslogtreecommitdiffstats
path: root/process.c
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2023-08-21 14:13:24 -0400
committerPeter Zhu <peter@peterzhu.ca>2023-08-27 09:39:29 -0400
commitb7237e3bbd36e7c520c4cbaf1f866b6dcc265a99 (patch)
tree45a80f00e101e5460f210d6c55c0a1a9b42a825c /process.c
parent5c98ee02d2ac7f20ab978be7645801adf03e4302 (diff)
downloadruby-b7237e3bbd36e7c520c4cbaf1f866b6dcc265a99.tar.gz
Free all empty heap pages in Process.warmup
This commit adds `free_empty_pages` which frees all empty heap pages and moves the number of pages freed to the allocatable pages counter. This is used in Process.warmup to improve performance because page invalidation from copy-on-write is slower than allocating a new page.
Diffstat (limited to 'process.c')
-rw-r--r--process.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/process.c b/process.c
index fa2ae7344a..37dc524415 100644
--- a/process.c
+++ b/process.c
@@ -8671,10 +8671,12 @@ static VALUE rb_mProcID_Syscall;
*
* On CRuby, +Process.warmup+:
*
- * * Perform a major GC.
+ * * Performs a major GC.
* * Compacts the heap.
* * Promotes all surviving objects to the old generation.
- * * Precompute the coderange of all strings.
+ * * Precomputes the coderange of all strings.
+ * * Frees all empty heap pages and increments the allocatable pages counter
+ * by the number of pages freed.
*/
static VALUE