Project

General

Profile

Feature #15667 » ruby_gc_malloc_trim.patch

mame (Yusuke Endoh), 03/20/2019 01:39 AM

View differences:

configure.ac
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)
gc.c
gc_prof_timer_start(objspace);
{
gc_marks(objspace, do_full_mark);
gc_marks(objspace, do_full_mark);
#ifdef HAVE_MALLOC_TRIM
/* [Experimental] Explicitly free all eligible pages to the kernel. See:
*
* - https://www.joyfulbikeshedding.com/blog/2019-03-14-what-causes-ruby-memory-bloat.html
* - https://bugs.ruby-lang.org/issues/15667
*/
if (do_full_mark) malloc_trim(0);
#endif
}
gc_prof_timer_stop(objspace);
(1-1/3)