summaryrefslogtreecommitdiffhomepage
path: root/src/gc.c
diff options
context:
space:
mode:
authorRory OConnell <[email protected]>2020-08-29 17:19:49 -0700
committerYukihiro "Matz" Matsumoto <[email protected]>2020-10-12 18:20:12 +0900
commitdae0de44617cf9e4584f8aa8cd34db4cd928a0c8 (patch)
tree1b642dc3dc81a9d964d750bb01b123c09c8e172b /src/gc.c
parentcfe8b0c81ddf1d221e4e1c6bb41d7e4c50d59fad (diff)
downloadmruby-dae0de44617cf9e4584f8aa8cd34db4cd928a0c8.tar.gz
mruby-dae0de44617cf9e4584f8aa8cd34db4cd928a0c8.zip
Add call to malloc_trim on a full GC
Diffstat (limited to 'src/gc.c')
-rw-r--r--src/gc.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/gc.c b/src/gc.c
index 393f7f62c..302d5cd68 100644
--- a/src/gc.c
+++ b/src/gc.c
@@ -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;
}