Project

General

Profile

Feature #15667 ยป ruby_gc_malloc_trim.patch

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

View differences:

configure.ac
1825 1825
AC_CHECK_FUNCS(lutimes)
1826 1826
AC_CHECK_FUNCS(malloc_usable_size)
1827 1827
AC_CHECK_FUNCS(malloc_size)
1828
AC_CHECK_FUNCS(malloc_trim)
1828 1829
AC_CHECK_FUNCS(mblen)
1829 1830
AC_CHECK_FUNCS(memalign)
1830 1831
AC_CHECK_FUNCS(memset_s)
gc.c
6660 6660

  
6661 6661
    gc_prof_timer_start(objspace);
6662 6662
    {
6663
	gc_marks(objspace, do_full_mark);
6663
        gc_marks(objspace, do_full_mark);
6664
#ifdef HAVE_MALLOC_TRIM
6665
        /* [Experimental] Explicitly free all eligible pages to the kernel.  See:
6666
         *
6667
         * - https://www.joyfulbikeshedding.com/blog/2019-03-14-what-causes-ruby-memory-bloat.html
6668
         * - https://bugs.ruby-lang.org/issues/15667
6669
         */
6670
        if (do_full_mark) malloc_trim(0);
6671
#endif
6664 6672
    }
6665 6673
    gc_prof_timer_stop(objspace);
6666 6674