diff options
author | Jean Boussier <byroot@ruby-lang.org> | 2023-09-15 16:22:09 +0200 |
---|---|---|
committer | Jean Boussier <jean.boussier@gmail.com> | 2023-09-15 17:45:21 +0200 |
commit | efe2822708d62bfe3ba858da526e6ef7d4724959 (patch) | |
tree | cafd2cc6bdbd6653a8fe1926911f1cd9c16e3a27 /gc.c | |
parent | 28fe88468d7bde129221415bfa874f4b70bf6843 (diff) | |
download | ruby-efe2822708d62bfe3ba858da526e6ef7d4724959.tar.gz |
Process.warmup: invoke `malloc_trim` if available
Similar to releasing free GC pages, releasing free malloc pages
reduce the amount of page faults post fork.
Diffstat (limited to 'gc.c')
-rw-r--r-- | gc.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -9740,6 +9740,10 @@ rb_gc_prepare_heap(void) rb_objspace_each_objects(gc_set_candidate_object_i, NULL); gc_start_internal(NULL, Qtrue, Qtrue, Qtrue, Qtrue, Qtrue); free_empty_pages(); + +#if defined(HAVE_MALLOC_TRIM) && !defined(RUBY_ALTERNATIVE_MALLOC_HEADER) + malloc_trim(0); +#endif } static int |