[erlang-questions] Change in garbage collector behavior?

Matthew Dempsky <>
Fri May 16 21:00:07 CEST 2008


I tried to create a small data structure with a lot of shared
subparts, but it seems in R12B-1 and R12B-2 both lead to crashes after
doing this.  I'm guessing it's in the garbage collector, because if I
don't store the result in a variable, it runs fine, but otherwise it
crashes later on.  I was pretty sure in the past (R11B-* or so),
Erlang has gracefully handled data structures with shared subparts
within a process; has this changed "recently"?

On an Ubuntu 7.10 machine running Erlang R12B-1 (I get similar results
on OS X 10.5 with either R12B-1 or R12B-2, but a segmentation fault
instead of a crash dump):

$ erl
Erlang (BEAM) emulator version 5.6.1 [source] [64-bit] [smp:4]
[async-threads:4] [hipe] [kernel-poll:true]

Eshell V5.6.1  (abort with ^G)
1> F = fun(N) -> lists:foldl(fun(_, X) -> [X | X] end, [],
lists:seq(1, N)) end.
#Fun<erl_eval.6.13229925>
2> A = F(20), ok.
ok
3> F(30), ok.
ok
4> B = F(30), ok.
ok
    %% It hangs here for a short while
Crash dump was written to: erl_crash.dump
eheap_alloc: Cannot allocate 17196648072 bytes of memory (of type "heap_frag").
Aborted



More information about the erlang-questions mailing list