aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnders Svensson <[email protected]>2016-09-12 22:31:18 +0200
committerAnders Svensson <[email protected]>2016-09-12 22:31:18 +0200
commit83c9b7347c0728c6864abcfbd0253af60ae0f3b7 (patch)
treefcfa8225c09dc97f293100ef1b273b20ea83f3c5
parentf245bcb173fc6697cfa2d69c51d960f17d85d47f (diff)
parent392a0a77a9c4fc4c9bdca1c2e6599ce34f07c93b (diff)
downloadotp-83c9b7347c0728c6864abcfbd0253af60ae0f3b7.tar.gz
otp-83c9b7347c0728c6864abcfbd0253af60ae0f3b7.tar.bz2
otp-83c9b7347c0728c6864abcfbd0253af60ae0f3b7.zip
Merge branch 'anders/diameter/min_heap_size/OTP-13796' into maint
* anders/diameter/min_heap_size/OTP-13796: Let unfortunate min_heap_size setting be disabled
-rw-r--r--lib/diameter/src/base/diameter_lib.erl24
1 files changed, 22 insertions, 2 deletions
diff --git a/lib/diameter/src/base/diameter_lib.erl b/lib/diameter/src/base/diameter_lib.erl
index b835e87967..3928769b5e 100644
--- a/lib/diameter/src/base/diameter_lib.erl
+++ b/lib/diameter/src/base/diameter_lib.erl
@@ -299,8 +299,28 @@ spawn_opts(server, Opts) ->
spawn_opts(worker, Opts) ->
opts(5000, Opts).
-opts(HeapSize, Opts) ->
- [{min_heap_size, HeapSize} | lists:keydelete(min_heap_size, 1, Opts)].
+%% These setting are historical rather than useful. In particular, the
+%% server setting can bloat many processes unnecessarily. Let them be
+%% disabled with -diameter min_heap_size false.
+
+opts(Def, Opts) ->
+ Key = min_heap_size,
+ case getenv(Key, Def) of
+ N when is_integer(N), 0 =< N ->
+ [{Key, N} | lists:keydelete(Key, 1, Opts)];
+ _ ->
+ Opts
+ end.
+
+%% getenv/1
+
+getenv(Key, Def) ->
+ case application:get_env(Key) of
+ {ok, T} ->
+ T;
+ undefined ->
+ Def
+ end.
%% ---------------------------------------------------------------------------
%% # wait/1