[erlang-questions] Erlang node memory consumption grows to 18GB in few seconds

Chaitanya Chalasani cchalasani@REDACTED
Sat Apr 14 16:22:45 CEST 2018


I suppose it is the io:format which is causing the issue. Removed the io:format and it works well now. 

> On 14-Apr-2018, at 15:25, Chaitanya Chalasani <cchalasani@REDACTED> wrote:
> 
> Hi,
> 
> I see the memory consumption of an erlang node grows exponentially and quickly when I was sending binary data of about 700 MB from shell to a simple erlang listener process and the shell process is stuck.
> 
> -module(strange).
> -export([start/0, listener/0, send/1, stop/0]).
> 
> start() ->
>   register(?MODULE, spawn(?MODULE, listener, [])).
> 
> listener() ->
>   receive
>     {send, Data} ->
>       io:format("Received Data ~p ~n", [Data]),
>       listener();
>     stop ->
>       io:format("Stopping listener ~n")
>   end.
> 
> send(Data) ->
>   ?MODULE ! {send, Data}.
> 
> stop() ->
>   ?MODULE ! stop.
> 
> $ uname -a
> Darwin Chaitanyas-MacBook-Pro.local 17.5.0 Darwin Kernel Version 17.5.0: Mon Mar  5 22:24:32 PST 2018; root:xnu-4570.51.1~1/RELEASE_X86_64 x86_64
> 
> $ erl
> Erlang/OTP 20 [erts-9.3] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]
> 
> Eshell V9.3  (abort with ^G)
> 1> c(strange).
> {ok,strange}
> 2> {ok, Data} = file:read_file("centos.iso").
> {ok,<<51,237,144,144,144,144,144,144,144,144,144,144,144,
>       144,144,144,144,144,144,144,144,144,144,144,144,
>       144,144,...>>}
> 3> strange:start().
> true
> 4> strange:send(Data).
> 
> BREAK: (a)bort (c)ontinue (p)roc info (i)nfo (l)oaded
>        (v)ersion (k)ill (D)b-tables (d)istribution
> 
> The observer says -
> <0.53.0>	group:server/3	93980000	17957208520	1	erlang:integer_to_list/1
> 
> The Mac activity monitor shows Erlang consuming 18GB of RAM.
> 
> Kindly, help me understand what is happening.
> 
> /Chaitanya

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20180414/f17e42da/attachment.htm>


More information about the erlang-questions mailing list