[erlang-questions] Ideas for a new Erlang

Richard A. O'Keefe <>
Thu Jun 26 07:32:38 CEST 2008

> I wrote:

> I hope that we can rely on Erlang garbage collection to
>> collect any process suspended in a receive construct and not  
>> registered
>> and not referenced by any other process.  If we can, the  
>> distinction is
>> only useful to people and not really needed by the computer.

Perhaps I should make it clear that I was not entirely serious in that
hope.  It *would* be nice, but it was really a stick to beat the  
proposal with.  Since channels can be used in the way that processes are
now, and since a reference to a Nystrom channel amounts to a reference  
its process, channels have much the same consequences for/problems with
distributed GC as processes.

On 26 Jun 2008, at 4:35 pm, Matthew Reilly wrote:
> This will doubtfully ever happen. Since erlang is distributed, a pid  
> may be referenced via a process on a completely different node, so  
> any garbage collection of pids would therefore need to be distributed.

Distributed GC is no longer rocket wizardry.
(Well, it _is_, but the wizards have published.)

> Adding on to this term_to_binary,  mnesia, ... pids could be stored  
> in different formats or even on disk.

The same, of course, applies to channels.  So when DO channels go away?
> You also may wish to have pids that are unreferenced by any other,  
> but still do important work e.g.
> loop() ->
>   after 1000 ->
>      % Touch the hardware watchdog to prevent the system from  
> reboooting
>      file:read_file("/dev/watchdog"),
>      ?MODULE:loop()
> end

Imprecise wording on my part; I didn't intend waiting for a timeout to  
only waiting for a message.

Interestingly, if you have channels, and a process is waiting for a  
on a channel, and no other process has a reference to that channel, the
process is effectively dead, no matter how many other channels it has or
how many other processes have references to them.

More information about the erlang-questions mailing list