Frage

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.

War es hilfreich?

Lösung

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.

Andere Tipps

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).
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top