why each erlang process sets 233 words as its default heap size?

View: New views
3 Messages — Rating Filter:   Alert me  

why each erlang process sets 233 words as its default heap size?

by Min Zhou :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all,
      My first instinction is that it want to club together with one process size  to reach exactly 1024 bytes . But each process has more than 1024/4 -233 = 23 words size .
      What's the author's original intention? why each erlang process  sets 233 words as  its default heap size?

Thx,
Jeremy


_______________________________________________
erlang-questions mailing list
erlang-questions@...
http://www.erlang.org/mailman/listinfo/erlang-questions

Re: why each erlang process sets 233 words as its default heap size?

by Erik Stenman-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On 20 sep 2007, at 18.03, Jeremy Chow wrote:

> Hi all,
>       My first instinction is that it want to club together with  
> one process size  to reach exactly 1024 bytes . But each process  
> has more than 1024/4 -233 = 23 words size .
>       What's the author's original intention? why each erlang  
> process  sets 233 words as  its default heap size?

The Erlang runtime system allocates memory for a process in  
increments of Fibonacci numbers.
The rational is apparently that memory usage has a tendency to grow  
like the Fibonacci numbers,
whether this really pays off is questionable but the code has been kept.
233 is a reasonably sized Fibonacci number and seems seemingly  
randomly chosen as a good initial start size.

/Erik Stenman



_______________________________________________
erlang-questions mailing list
erlang-questions@...
http://www.erlang.org/mailman/listinfo/erlang-questions

Re: why each erlang process sets 233 words as its default heap size?

by Pierpaolo BERNARDI-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 9/20/07, Jeremy Chow <coderplay@...> wrote:
> Hi all,
>       My first instinction is that it want to club together with one process
> size  to reach exactly 1024 bytes . But each process has more than 1024/4
> -233 = 23 words size .
>       What's the author's original intention? why each erlang process  sets
> 233 words as  its default heap size?

The heap size is a fibonacci number.

<guess>
Maybe 233 is the smallest fibonacci number that allows to do something useful.
</guess>

The sequence is: ... 89 144 233 377 610 ...

P.
_______________________________________________
erlang-questions mailing list
erlang-questions@...
http://www.erlang.org/mailman/listinfo/erlang-questions