[erlang-questions] Early Out of Memory

Patrik Nyblom pan@REDACTED
Fri Mar 1 10:33:35 CET 2013


Hi!
On 03/01/2013 07:09 AM, Vance Shipley wrote:
> In the pathological example below why is eheap_alloc failing to
> allocate 1.4GB of memory on a system with many more gigabytes of
> memory available?
Looks like you're running a 32 bit VM, in which case you have at a 
absolute maximum 4GB of memory. A heap allocation of 1.3 GB means an old 
version of the heap of possibly the same size (copying GC) + old heap 
generations and so on. A heap also needs to have continuous virtual 
memory, so the chance of having a single process with this much heap 
running on a 32bit VM is slim at best. If you have a lot of physical 
memory in the machine, run a 64bit OS and a 64bit Erlang VM.
>
> Erlang R16B (erts-5.10.1) [source] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false]
>
> Eshell V5.10.1  (abort with ^G)
> 1> F = fun(F, Acc) -> F(F, [lists:seq(1,1000) | Acc]) end.
> #Fun<erl_eval.12.17052888>
> 2> F(F, []).
> beam.smp(73592,0xb039d000) malloc: *** mmap(size=549453824) failed (error code=12)
>    *** error: can't allocate region
>                                    *** set a breakpoint in malloc_error_break to debug
>       beam.smp(73592,0xb039d000) malloc: *** mmap(size=1139802112) failed (error code=12)
>          *** error: can't allocate region
>                                          *** set a breakpoint in malloc_error_break to debug
>             beam.smp(73592,0xb039d000) malloc: *** mmap(size=1367343104) failed (error code=12)
>                *** error: can't allocate region
>                                                *** set a breakpoint in malloc_error_break to debug
>                   beam.smp(73592,0xb039d000) malloc: *** mmap(size=1367343104) failed (error code=12)
>                      *** error: can't allocate region
>                                                      *** set a breakpoint in malloc_error_break to debug
>                         beam.smp(73592,0xb039d000) malloc: *** mmap(size=1366781952) failed (error code=12)
>                            *** error: can't allocate region
>                                                            *** set a breakpoint in malloc_error_break to debug
>                               beam.smp(73592,0xb039d000) malloc: *** mmap(size=1366781952) failed (error code=12)
>                                  *** error: can't allocate region
>                                                                  *** set a breakpoint in malloc_error_break to debug
>
> Crash dump was written to: erl_crash.dump
> eheap_alloc: Cannot allocate 1366780092 bytes of memory (of type "heap").
> Abort trap: 6
>
Cheers,
/Patrik




More information about the erlang-questions mailing list