[erlang-questions] Erlang processes and state management design
Thomas Lindgren
thomasl_erlang@REDACTED
Wed Oct 24 16:56:46 CEST 2007
--- Alexander Lamb <alexander.lamb@REDACTED>
wrote:
> But you seem to not consider solution 2 (process
> dictionnary). Is
> this because it is not efficient, or at least not
> more efficient than
> parameters?
I'd recommend not relying on the process dictionary.
Granted, there are cases when it is useful, but you
get all the problems of (process-)global variables
too.
> Also, I read somewhere that the heap for processes
> in Erlang was
> rather small for historical reasons. If I store data
> in the
> parameters or in the process dictionnary, will I run
> into some limit?
A process heap is by default small _initially_, but it
will grow dynamically on demand. It's just an
optimization to permit plenty of processes without
running out of memory.
> Alternatively, I suppose the data for ETS structures
> are stored on
> the node's heap and not in the process heap? Is this
> correct?
As far as I know, yes. However, reading data from ets
copies it into the process heap. (As I understand it,
this is true even for the hybrid runtime system.)
Best,
Thomas
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
More information about the erlang-questions
mailing list