Garbage collection of binaries

Joachim Durchholz joachim.durchholz@REDACTED
Fri Oct 17 11:14:58 CEST 2003

Sean Hinde wrote:
> Is there not some mechanism which could be introduced to specifically 
> check for processes growing in this way - I don't know, perhaps every 
> time a very large binary is assigned on the heap check to see if it 
> might be a good time do do a "survival" GC? Maybe a running total could 
> be kept of binaries assigned over a certain size?

Yuck - that's all things that GC is already supposed to do.

One thing that I have seen happen is that GC didn't take the binaries 
into account when deciding whether it should collect or not. In other 
words, the decision was made based on heap use, not based on total 
memory footprint. In that case, it's quite easy to fill up the entire 
swap space without the GC ever kicking in.

Personally, I think that binaries should not be reference counted, they 
should be managed by an Erlang object that keeps the information on the 
true size of the binary. YMMV :-)


More information about the erlang-questions mailing list