diff options
author | Peter Zhu <peter@peterzhu.ca> | 2023-08-21 14:13:24 -0400 |
---|---|---|
committer | Peter Zhu <peter@peterzhu.ca> | 2023-08-27 09:39:29 -0400 |
commit | b7237e3bbd36e7c520c4cbaf1f866b6dcc265a99 (patch) | |
tree | 45a80f00e101e5460f210d6c55c0a1a9b42a825c /process.c | |
parent | 5c98ee02d2ac7f20ab978be7645801adf03e4302 (diff) |
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.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/8257
Diffstat (limited to 'process.c')
-rw-r--r-- | process.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -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 |