[erlang-questions] Erlang node memory consumption grows to 18GB in few seconds
Dmitry Kolesnikov
dmkolesnikov@REDACTED
Sun Apr 15 13:15:06 CEST 2018
Hello,
`io:format(…)` is your problem in this example.
Best Regards,
Dmitry
> On 14 Apr 2018, at 12.55, 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
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20180415/a7655809/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Message signed with OpenPGP
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20180415/a7655809/attachment.bin>
More information about the erlang-questions
mailing list