Can anyone explain this Erlang Crash dump?

811 views Asked by At

I got this error report when running my Erlang application.


Crash dump was written to: erl_crash.dump

eheap_alloc: Cannot allocate 18446744071692551144 bytes of memory (of type "heap").

It's a simple program ran on a simple PC. How is it possible to get such numbers? It is trying to allocate 10^10 gb by the way. The program basically only runs tail recursion and a quite low amount of processes.

2

There are 2 answers

0
Marutha On BEST ANSWER

If you get this error while running you application that means that one of your functions are calling recursively and trying to allocate that much memory where OS would not provide to VM and hence VM crashes with that memory allocation error.

0
Nick X On

Previously when I was running into similar dumps, it was caused by a huge mailbox in a process, it had piled millions of messages.

You could check it with this snippet of code:

top() ->
    Procs = lists:foldl(fun(Pid, Acc) ->
        case erlang:process_info(Pid, message_queue_len) of
            {_K, V} -> [{Pid, V} | Acc];
            _ -> Acc
        end
    end, [], erlang:processes()),
    lists:keysort(2, Procs).