[erlang-questions] how to break the problem. the erlang way?

Mihai Balea mihai@REDACTED
Fri Jul 31 22:39:21 CEST 2009


On Jul 31, 2009, at 4:27 PM, Witold Baryluk wrote:

> Dnia 2009-07-31, pią o godzinie 23:09 +0300, Ovidiu Deac pisze:
>> On Fri, Jul 31, 2009 at 6:41 PM, Mihai Balea<mihai@REDACTED> wrote:
> h
>>>
>>> One advantage of having transient processes is that you can tune  
>>> them to
>>> never need garbage collection, which is not the case for long lived
>>> processes.
>>
>> Can you detail this part? I don't think I understand what you mean by
>> "tune them to never need garbage collection" but it sounds good :)
>
> I think He mean that if spawned process will do its job quickly
> (and it will not trigger garbage collection due to small usage of own
> heap and stack), all memory will be freed after its terminate.
> So it will still reclaim its memory, but it will be trivial and
> ultra fast.

Yes, that is gist of it.

GC in Erlang is done on a per-process basis - each process has its own  
heap that is managed  and collected independently.
If the process is sufficiently short lived, it will terminate before  
GC is triggered and the entire process memory is reclaimed in one very  
fast  step. By "fine-tuning" I was referring to the ability to set the  
initial process heap, when you spawn the process.

Mihai


More information about the erlang-questions mailing list