[erlang-questions] Erlang Memory Question
Wed Sep 24 03:13:51 CEST 2014
Well, yes I may deliberately lie.
However my suggestion is to, instead of doing a full sweep by the garbage
collector (GC) to identify data going out of scope and reclaim, can the
program (or rather I) deliberately say I (the calling process) is finished
using the said data, so the GC may free that part.
Then the GC may carry out it's own logic, which it currently does to verify
if the same data is referenced by any other processes, etc., and decide if
to GC or not.
On Tue, Sep 23, 2014 at 12:42 PM, Richard A. O'Keefe <ok@REDACTED>
> 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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions