[erlang-questions] standard_io out of memory crash

Volodymyr Kyrychenko <>
Fri Aug 26 18:26:05 CEST 2011


code:

-module(outofmem).
-export([main/0]).

main() ->
    receive
        X -> X
    end.

$ cat really_big_file | erl -noshell -s outofmem main

will consume all available memory and crash:

Slogan: binary_alloc: Cannot allocate 65567 bytes of memory (of type
"binary").
System version: Erlang R14B03 (erts-5.8.4) [source] [64-bit] [smp:8:8]
[rq:8] [async-threads:0] [hipe] [kernel-poll:false]
Compiled: Mon May 30 15:59:01 2011
Taints:.

Actual problem was discovered while trying to process some 16GB file.
If the processing code consumes lines from standard_io slower than
erlang consumes pipe data - it will eat all memory and crash.
-- 
Volodymyr Kyrychenko

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110826/7c697946/attachment.bin>


More information about the erlang-questions mailing list