1

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.

1
  • 3
    Show your code. It might be it is not tail recursion in your code, so it runs not in constant address space. Dec 4, 2013 at 4:15

2 Answers 2

3

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

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).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.