aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_gc.c
diff options
context:
space:
mode:
authorErlang/OTP <[email protected]>2010-01-15 13:24:13 +0000
committerErlang/OTP <[email protected]>2010-01-15 13:24:13 +0000
commite9adb6d0ef8426dec1f8f3211cabb49fc4464c01 (patch)
treea7bc9ea5829ca652d8c56f3486365119ddc85b91 /erts/emulator/beam/erl_gc.c
parent3bd9363f6a0e7394dcae26748ea55683790a1004 (diff)
parent51964ac6cd3087e9e187aab15d2f83db94c5d565 (diff)
downloadotp-e9adb6d0ef8426dec1f8f3211cabb49fc4464c01.tar.gz
otp-e9adb6d0ef8426dec1f8f3211cabb49fc4464c01.tar.bz2
otp-e9adb6d0ef8426dec1f8f3211cabb49fc4464c01.zip
Merge branch 'egil/binary-gc' into ccase/r13b04_dev
* egil/binary-gc: Add documentation for binary heap size settings. Add tracing capabilities for binary virtual heap Add min heap size start options to beam and erl Improve binary garbage collection OTP-8370 The default settings for garbage collection of binaries has been adjusted to be less aggressive than in R13B03. It is now also possible configure the settings for binary GC. See the documentation for spawn_opt/2-5, erlang:system_info/1, erlang:system_flag/2, process_flag/2-3, erlang:trace/3, and the documenation for erl for the new command line options +hms and +hmbs.
Diffstat (limited to 'erts/emulator/beam/erl_gc.c')
-rw-r--r--erts/emulator/beam/erl_gc.c46
1 files changed, 34 insertions, 12 deletions
diff --git a/erts/emulator/beam/erl_gc.c b/erts/emulator/beam/erl_gc.c
index 363f956b58..e9bf37a173 100644
--- a/erts/emulator/beam/erl_gc.c
+++ b/erts/emulator/beam/erl_gc.c
@@ -2031,23 +2031,45 @@ shrink_new_heap(Process *p, Uint new_sz, Eterm *objv, int nobj)
}
static Uint
-next_vheap_size(Uint vheap, Uint vheap_sz) {
- if (vheap < H_MIN_SIZE) {
- return H_MIN_SIZE;
- }
+do_next_vheap_size(Uint vheap, Uint vheap_sz) {
+
+ /* grow
+ *
+ * vheap_sz ======================
+ *
+ * vheap 75% + grow
+ * ----------------------
+ *
+ * vheap 25 - 75% same
+ * ----------------------
+ *
+ * vheap ~ - 25% shrink
+ *
+ * ----------------------
+ */
- /* grow */
- if (vheap > vheap_sz) {
- return erts_next_heap_size(2*vheap, 0);
+ if (vheap > (Uint) (vheap_sz*3/4)) {
+
+ while(vheap > (Uint) (vheap_sz*3/4)) {
+ vheap_sz = vheap_sz*2;
+ }
+
+ return erts_next_heap_size(vheap_sz, 0);
}
- /* shrink */
- if ( vheap < vheap_sz/2) {
- return (Uint)vheap_sz*3/4;
+
+ if (vheap < (Uint) (vheap_sz/4)) {
+ return erts_next_heap_size((Uint) (vheap_sz / 2), 0);
}
return vheap_sz;
+
}
+static Uint
+next_vheap_size(Process* p, Uint vheap, Uint vheap_sz) {
+ vheap_sz = do_next_vheap_size(vheap, vheap_sz);
+ return vheap_sz < p->min_vheap_size ? p->min_vheap_size : vheap_sz;
+}
static void
sweep_proc_externals(Process *p, int fullsweep)
@@ -2250,8 +2272,8 @@ sweep_proc_bins(Process *p, int fullsweep)
FLAGS(p) |= F_NEED_FULLSWEEP;
}
- BIN_VHEAP_SZ(p) = next_vheap_size(bin_vheap, BIN_VHEAP_SZ(p));
- BIN_OLD_VHEAP_SZ(p) = next_vheap_size(BIN_OLD_VHEAP(p), BIN_OLD_VHEAP_SZ(p));
+ BIN_VHEAP_SZ(p) = next_vheap_size(p, bin_vheap, BIN_VHEAP_SZ(p));
+ BIN_OLD_VHEAP_SZ(p) = next_vheap_size(p, BIN_OLD_VHEAP(p), BIN_OLD_VHEAP_SZ(p));
MSO(p).overhead = bin_vheap;
/*