Mon Oct 16 18:26:27 CEST 2000
> Is there any reason why each process keeps its own separate heap instead of one global heap?
Yes: The time for garbage-collection can be kept down this way. If all processes use one global heap then the garbage collector would have to scan all processes stacks in order to get the root-set.
Also, some programmers use the fact that each process has its own heap as a poor-mans memory manager, by spawning a separate process for a computation that will do a short computation generating a lot of garbage the whole heap of the new process can be reclaimed at once when the computation is finished - no GC needed.
In real-time applications one do not want one memory hungry process to be able to generate garbage that other, perhaps more important, processes has to GC.
> Doesn't the cost of sending large complex
> structures as messages among processes in the same node justify it? - ie.,
> instead of just copying pointers to the process mailbox.
Perhaps. The question is whether large messages are sent often enough. For the programs we (The HiPE group) have access to, which admittedly are few, measurements show that most messages are small.
We plan to implement a shared heap with several generations to test whether this is the case or not.
More information about the erlang-questions