diff --git a/src/emqx_misc.erl b/src/emqx_misc.erl index 03c42510c..852113a8c 100644 --- a/src/emqx_misc.erl +++ b/src/emqx_misc.erl @@ -63,8 +63,14 @@ proc_stats(Pid) -> -define(DISABLED, 0). init_proc_mng_policy(Zone) -> - #{max_heap_size := MaxHeapSizeInBytes} = ShutdownPolicy = - emqx_zone:get_env(Zone, force_shutdown_policy), + #{max_heap_size := MaxHeapSizeInBytes} + = ShutdownPolicy + = case Zone of + undefined -> + #{max_heap_size => 0}; + _ -> + emqx_zone:get_env(Zone, force_shutdown_policy) + end, MaxHeapSize = MaxHeapSizeInBytes div erlang:system_info(wordsize), _ = erlang:process_flag(max_heap_size, MaxHeapSize), % zero is discarded erlang:put(force_shutdown_policy, ShutdownPolicy), @@ -106,4 +112,3 @@ is_enabled(Max) -> is_integer(Max) andalso Max > ?DISABLED. proc_info(Key) -> {Key, Value} = erlang:process_info(self(), Key), Value. -