<div dir="ltr">Hello Stu!<div><br></div><div style>As Bengt pointed out you need a 64 bit erlang emulator because the list you created in 2 words * 100 million which would be about 1.6 GB. When the copying GC kicks in that expands to very close to 4GB which is the max in a 32 bit emulator. To compile a 64 but emulator on OS X see <a href="http://www.erlang.org/doc/installation_guide/INSTALL.html#id72320">http://www.erlang.org/doc/installation_guide/INSTALL.html#id72320</a></div>
<div style><br></div><div style>Lukas</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Mar 27, 2013 at 7:31 AM, Danil Zagoskin <span dir="ltr"><<a href="mailto:z@gosk.in" target="_blank">z@gosk.in</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi, Stu.<div><br></div><div>Does your beam crash when you call lists:duplicate(<span style="font-family:arial,sans-serif;font-size:13px">100000000</span>, a) ?</div>
<div><br></div><div>The difference is lists:duplicate is tail-recursive while lists:seq and big_lists:make_list are body-recursive so you can hit some stack size limit, not lists length one.</div>

</div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/3/27 Stu Bailey <span dir="ltr"><<a href="mailto:stu.bailey@gmail.com" target="_blank">stu.bailey@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div class="h5">

<div>Hi all,</div><div><br></div><div>I have an 8 core MacBook Pro Retina Display with 16GB of memory.   I am running R16B with no configure options...but I did install libatomic_ops-7.2 .     I tried a very simple list allocation test which surprisingly failed with a list size of 100 million.    I first made a list with 10 million integers.   The beam hung on 100 million.   Thinking it was something with lists:seq, I just wrote a dumb test to build big lists of single character atoms.  That also failed at 100 million.   Is there a known limitation to the size of lists in Erlang?</div>



<div><br></div><div><div>bash-3.2$ uname -a</div><div>Darwin myhost.local 12.3.0 Darwin Kernel Version 12.3.0: Sun Jan  6 22:37:10 PST 2013; root:xnu-2050.22.13~1/RELEASE_X86_64 x86_64</div></div><div><br></div><div>bash-3.2$ erl</div>



<div>Erlang R16B (erts-5.10.1) [source] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false]</div><div><br></div><div>My Erlang Environment</div><div>Eshell V5.10.1  (abort with ^G)</div><div>1> lists:seq(1,10000000).</div>



<div>[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,</div><div> 23,24,25,26,27,28,29|...]</div><div>2> lists:seq(1,100000000).   </div><div>beam.smp(85491,0xb039d000) malloc: *** mmap(size=458227712) failed (error code=12)</div>



<div>                                                                                  *** error: can't allocate region</div><div>                                                                                                                  *** set a breakpoint in malloc_error_break to debug</div>



<div>        beam.smp(85491,0xb039d000) malloc: *** mmap(size=659554304) failed (error code=12)</div><div>                                                                                          *** error: can't allocate region</div>



<div>                                                                                                                          *** set a breakpoint in malloc_error_break to debug</div><div>                beam.smp(85491,0xb039d000) malloc: *** mmap(size=791674880) failed (error code=12)</div>



<div>                                                                                                  *** error: can't allocate region</div><div>                                                                                                                                  *** set a breakpoint in malloc_error_break to debug</div>



<div>                        beam.smp(85491,0xb039d000) malloc: *** mmap(size=791674880) failed (error code=12)</div><div>                                                                                                          *** error: can't allocate region</div>



<div>                                                                                                                                          *** set a breakpoint in malloc_error_break to debug</div><div>                                beam.smp(85491,0xb039d000) malloc: *** mmap(size=791674880) failed (error code=12)</div>



<div>                                                                                                                  *** error: can't allocate region</div><div>                                                                                                                                                  *** set a breakpoint in malloc_error_break to debug</div>



<div>                                        beam.smp(85491,0xb039d000) malloc: *** mmap(size=790962176) failed (error code=12)</div><div>                                                                                                                          *** error: can't allocate region</div>



<div>                                                                                                                                                          *** set a breakpoint in malloc_error_break to debug</div><div>



                                                beam.smp(85491,0xb039d000) malloc: *** mmap(size=790962176) failed (error code=12)</div><div>                                                                                                                                  *** error: can't allocate region</div>



<div>     *** set a breakpoint in malloc_error_break to debug</div><div>                                                        Killed: 9</div><div><br></div><div><br></div><div>================</div><div><br></div><div>


<div>
-module(big_lists).</div><div><br></div><div>-compile([export_all]).</div><div><br></div><div><br></div><div>make_list(0,Acc)-></div><div>    Acc;</div><div>make_list(Size,Acc) -></div><div>    make_list(Size-1, [a] ++ Acc).</div>



</div><div><br></div><div>===================</div><div><br></div><div><div>5> c(big_lists).           </div><div>{ok,big_lists}</div><div>6> big_lists:make_list(2,[]).</div><div>[a,a]</div><div>7> big_lists:make_list(100000,[]).</div>



<div>[a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a|...]</div><div>8> big_lists:make_list(1000000,[]).</div><div>[a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a|...]</div><div>9> big_lists:make_list(10000000,[]).</div>



<div>[a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a|...]</div><div>10> big_lists:make_list(100000000,[]).</div><div>beam.smp(85534,0xb039d000) malloc: *** mmap(size=381681664) failed (error code=12)</div><div>



                                                                                  *** error: can't allocate region</div><div>                                                                                                                  *** set a breakpoint in malloc_error_break to debug</div>



<div>        beam.smp(85534,0xb039d000) malloc: *** mmap(size=659554304) failed (error code=12)</div><div>                                                                                          *** error: can't allocate region</div>



<div>                                                                                                                          *** set a breakpoint in malloc_error_break to debug</div><div>                beam.smp(85534,0xb039d000) malloc: *** mmap(size=791674880) failed (error code=12)</div>



<div>                                                                                                  *** error: can't allocate region</div><div>                                                                                                                                  *** set a breakpoint in malloc_error_break to debug</div>



<div>                        [a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a,a|...]</div><div>beam.smp(85534,0xb039d000) malloc: *** mmap(size=950009856) failed (error code=12)</div><div>                                                                                  *** error: can't allocate region</div>



<div>                                                                                                                  *** set a breakpoint in malloc_error_break to debug</div><div>        beam.smp(85534,0xb039d000) malloc: *** mmap(size=950009856) failed (error code=12)</div>



<div>                                                                                          *** error: can't allocate region</div><div>                                                                                                                          *** set a breakpoint in malloc_error_break to debug</div>



<div>                beam.smp(85534,0xb039d000) malloc: *** mmap(size=949153792) failed (error code=12)</div><div>                                                                                                  *** error: can't allocate region</div>



<div>                                                                                                                                  *** set a breakpoint in malloc_error_break to debug</div><div>                        beam.smp(85534,0xb039d000) malloc: *** mmap(size=949153792) failed (error code=12)</div>



<div>                                                                                                          *** error: can't allocate region</div><div>                                                                                                                                          *** set a breakpoint in malloc_error_break to debug</div>



<div><br></div><div>Crash dump was written to: erl_crash.dump</div><div>eheap_alloc: Cannot allocate 949152844 bytes of memory (of type "heap").</div><div>Abort trap: 6</div></div><div><br></div>
<br></div></div><div class="im">_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br></div></blockquote></div><br></div>
<br>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
<br></blockquote></div><br></div>