[erlang-questions] Erlang and Memory management

Jachym Holecek freza@REDACTED
Thu Jun 2 15:45:29 CEST 2011


# Jesper Louis Andersen 2011-06-01:
> On Wed, Jun 1, 2011 at 15:49, Michael Turner
> <michael.eugene.turner@REDACTED> wrote:
> > Copying a data structure is also an opportunity to construct a "fresh" data
> > structure that's relatively unfragmented. Lower fragmentation of data
> > structures would make cache fetches more efficient, and cache hits hits more
> > likely, for the receiver.
> 
> Garbage Collection will usually unfragment data anyway. But the
> process heap acts as a crude region-based memory manager: When a
> process dies, we can *instantly* reset its memory area and give it
> back. And that kind of cleanup is really effective. This gives us a
> region of memory of which we have some control, due to the lifetime of
> the process. In a shared heap, you loose that control and have to wait
> until the next GC for the memory to be reclaimed. The fact that you
> can tune the GC of each process rather than for the whole VM is also a
> pretty good thing.

Well, sometimes you know your process acts as a lightweight message
dispatcher (do very little work on received requests and then forward
them to some other process), other times you know your process is a
transient worker with heavy memory consumption...

So I guess it would be sweet to have both, and select suitable strategy
at process creation time. Not that I'm volunteering to implement that
though :-).

BR,
	-- Jachym



More information about the erlang-questions mailing list