Unverified Commit dae0de44 authored by Rory OConnell's avatar Rory OConnell Committed by Yukihiro "Matz" Matsumoto

Add call to malloc_trim on a full GC

parent cfe8b0c8
......@@ -6,6 +6,9 @@
#include <string.h>
#include <stdlib.h>
#ifdef HAS_MALLOC_TRIM
#include <malloc.h>
#endif
#include <mruby.h>
#include <mruby/array.h>
#include <mruby/class.h>
......@@ -1319,6 +1322,9 @@ mrb_full_gc(mrb_state *mrb)
gc->full = FALSE;
}
#ifdef HAS_MALLOC_TRIM
malloc_trim(0);
#endif
GC_TIME_STOP_AND_REPORT;
}
......
......@@ -31,6 +31,8 @@ MRuby::Toolchain.new(:gcc) do |conf, params|
end
[[conf.cc, 'c'], [conf.cxx, 'c++']].each do |cc, lang|
cc.defines += %w(HAS_MALLOC_TRIM) if cc.has_function? 'malloc_trim', with_header: 'malloc.h'
cc.instance_variable_set :@header_search_language, lang
def cc.header_search_paths
if @header_search_command != command
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment