aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/bif.c
diff options
context:
space:
mode:
authorDmytro Lytovchenko <[email protected]>2016-06-13 12:05:55 +0200
committerLukas Larsson <[email protected]>2016-08-12 13:39:03 +0200
commit58d8a3ac4d491c8cd962ac0839a56cd1a0e339f9 (patch)
treeee73059b660ab09d55e3b8bc7d4dd4bf53bb07ae /erts/emulator/beam/bif.c
parent451ca8e5ca10892342ee8627de7ea961a8f06df2 (diff)
downloadotp-58d8a3ac4d491c8cd962ac0839a56cd1a0e339f9.tar.gz
otp-58d8a3ac4d491c8cd962ac0839a56cd1a0e339f9.tar.bz2
otp-58d8a3ac4d491c8cd962ac0839a56cd1a0e339f9.zip
Option to erlang:garbage_collect to request minor (generational) GC
Note: Minor GC option is a hint, and GC may still decide to run fullsweep. Test case for major and minor gc on self Test case for major and minor gs on some other process + async gc test check docs fix
Diffstat (limited to 'erts/emulator/beam/bif.c')
-rw-r--r--erts/emulator/beam/bif.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/erts/emulator/beam/bif.c b/erts/emulator/beam/bif.c
index d9048065c8..84eab5f651 100644
--- a/erts/emulator/beam/bif.c
+++ b/erts/emulator/beam/bif.c
@@ -3869,7 +3869,24 @@ BIF_RETTYPE garbage_collect_0(BIF_ALIST_0)
{
FLAGS(BIF_P) |= F_NEED_FULLSWEEP;
erts_garbage_collect(BIF_P, 0, NULL, 0);
- BIF_RET(am_true);
+ return am_true;
+}
+
+/*
+ * Pass atom 'minor' for relaxed generational GC run. This is only
+ * recommendation, major run may still be chosen by VM.
+ * Pass atom 'major' for default behaviour - major GC run (fullsweep)
+ */
+BIF_RETTYPE
+erts_internal_garbage_collect_1(BIF_ALIST_1)
+{
+ switch (BIF_ARG_1) {
+ case am_minor: break;
+ case am_major: FLAGS(BIF_P) |= F_NEED_FULLSWEEP; break;
+ default: BIF_ERROR(BIF_P, BADARG);
+ }
+ erts_garbage_collect(BIF_P, 0, NULL, 0);
+ return am_true;
}
/**********************************************************************/