From 17d70772a8fe63b520f2c9b81ba3e213310ae473 Mon Sep 17 00:00:00 2001 From: Zaiming Shi Date: Sat, 23 Jan 2021 10:55:00 +0100 Subject: [PATCH 1/2] refactor(emqx_recon): Use latest version recon Moved recon dependency from emqx_recon to root --- apps/emqx_recon/rebar.config | 2 +- rebar.config | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/emqx_recon/rebar.config b/apps/emqx_recon/rebar.config index adb1d4c65..1a6f20d2b 100644 --- a/apps/emqx_recon/rebar.config +++ b/apps/emqx_recon/rebar.config @@ -1,5 +1,5 @@ {deps, [ - {recon, {git, "https://github.com/ferd/recon", {tag, "2.5.0"}}} +%% recon "https://github.com/ferd/recon" at root rebar.config ]}. {edoc_opts, [{preprocess, true}]}. diff --git a/rebar.config b/rebar.config index d97511c69..bed07d569 100644 --- a/rebar.config +++ b/rebar.config @@ -54,6 +54,7 @@ , {pbkdf2, {git, "https://github.com/emqx/erlang-pbkdf2.git", {branch, "2.0.4"}}} , {emqtt, {git, "https://github.com/emqx/emqtt", {tag, "1.2.3"}}} , {rulesql, {git, "https://github.com/emqx/rulesql", {tag, "0.1.2"}}} + , {recon, {git, "https://github.com/ferd/recon", {tag, "2.5.1"}}} , {getopt, "1.0.1"} ]}. From de972b3d846da3744871bbad7e45fd4fb3b46b35 Mon Sep 17 00:00:00 2001 From: Zaiming Shi Date: Sat, 23 Jan 2021 11:00:41 +0100 Subject: [PATCH 2/2] fix(emqx_vm): Call recon_alloc:allocators/0 to get allocators --- src/emqx_vm.erl | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/emqx_vm.erl b/src/emqx_vm.erl index e1ab29b8b..5094eea03 100644 --- a/src/emqx_vm.erl +++ b/src/emqx_vm.erl @@ -275,14 +275,8 @@ util_alloc()-> alloc(?UTIL_ALLOCATORS). alloc(Type) -> - [{{T, Instance}, Props} || {{T, Instance}, Props} <- allocators(), lists:member(T, Type)]. - -allocators() -> - UtilAllocators = erlang:system_info(alloc_util_allocators), - Allocators = [sys_alloc, mseg_alloc|UtilAllocators], - [{{A, N}, lists:sort(proplists:delete(versions, Props))} || - A <- Allocators, Allocs <- [erlang:system_info({allocator, A})], - Allocs =/= false, {_, N, Props} <- Allocs]. + [{{T, Instance}, Props} || + {{T, Instance}, Props} <- recon_alloc:allocators(), lists:member(T, Type)]. container_size(Prop, Keyword, Container) -> Sbcs = container_value(Prop, Keyword, sbcs, Container),