[erlang-questions] Erlang Memory Question

Richard A. O'Keefe ok@REDACTED
Tue Sep 23 09:12:12 CEST 2014

On 23/09/2014, at 2:24 PM, Eranga Udesh wrote:

> Thanks for the information received so far.
> Wouldn't it be good for Erlang to have a single object garbage collection function/bif?

NO.  In C it's called free() and it's a major cause of errors.

> For example, when I no longer require a large object, I force to garbage collect it, without making a full sweep?

Why should the garbage collector *believe* you that the "object"
is free?  You could be deliberately lying.  You could (and
probably are) be mistaken.  How is it to know which bits you
want to keep without doing its usual thing?  In a shared heap
implementation (which Erlang has had and may have again) the
fact that *you've* finished with the object doesn't mean
everyone *else* has.  A meaningful operation should not depend
on implementation details like that.
> As mentioned in the document, a full sweep may degrade the performance.

Not half as much as freeing too much would!

This is micro-optimisation.  Avoid passing around large
objects in the first place.

More information about the erlang-questions mailing list