문제

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.

도움이 되었습니까?

해결책

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.

다른 팁

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).
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top