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.
This commit is contained in:
parent
28fe88468d
commit
efe2822708
@ -2078,6 +2078,7 @@ AC_CHECK_FUNCS(lstat)
|
||||
AC_CHECK_FUNCS(lutimes)
|
||||
AC_CHECK_FUNCS(malloc_usable_size)
|
||||
AC_CHECK_FUNCS(malloc_size)
|
||||
AC_CHECK_FUNCS(malloc_trim)
|
||||
AC_CHECK_FUNCS(mblen)
|
||||
AC_CHECK_FUNCS(memalign)
|
||||
AC_CHECK_FUNCS(memset_s)
|
||||
|
4
gc.c
4
gc.c
@ -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
|
||||
|
@ -8789,6 +8789,7 @@ static VALUE rb_mProcID_Syscall;
|
||||
* * 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_trim+ if available to free empty malloc pages.
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
|
Loading…
x
Reference in New Issue
Block a user