[erlang-questions] moving process state - copy on write - heap memory increase

Ulf Wiger <>
Wed Sep 12 12:28:04 CEST 2012


On 12 Sep 2012, at 09:38, Richard O'Keefe wrote:

> I imagine most of us would be very happy with term_to_binary
> and message sending preserving sharing as long as it didn't
> slow existing code down more than a percent or two.  Not
> because we _want_ to pass terms with lots of sharing but
> because it's so much nicer not to have to worry about that.

Indeed. The list archives also contain examples of where the
loss of sharing has proven fatal (only to the program, thankfully).

http://erlang.org/pipermail/erlang-bugs/2007-November/000488.html

http://erlang.org/pipermail/erlang-questions/2005-November/017926.html

Admittedly, the cases where preserved sharing is really needed,
and the lack of it is very hard to work around, are few. In the first 
example above, it was difficult to overcome; in the second example,
it was accidental, easy to fix, but not that easy to debug*.

BR,
Ulf W

* The memory explosion occurred in a process that ran embarrassingly
trivial code, so it took a while before it occurred to me that it might be 
gobbling up memory, but of course the penalty (in terms of increased
memory footprint) for the flattening is paid by the _receiving_ process,
and not the sending one.

Ulf Wiger, Co-founder & Developer Advocate, Feuerlabs Inc.
http://feuerlabs.com






More information about the erlang-questions mailing list