[erlang-questions] Actor garbage collection
Thu Nov 4 22:45:17 CET 2010
On Thu, Nov 4, 2010 at 3:46 PM, Tony Hannan <> wrote:
> Thanks guys. It would be nice, although I know its hard in a distributed
> setting, but there is research on it. See
The main problem in a distributed setting is node failure -
if you have dangling references (ie references to nodes that have
failed) things become *incredibly* difficult - we realised this in
1985 :-) - that's why erlang processes copy messages between processes
- so that remote processes have no dangling data references. Now the
problem is no longer hard but reduces to
local node collections.
> On Thu, Nov 4, 2010 at 10:19 AM, Robert Virding <
> > wrote:
>> No, processes are never removed until they are explicitly killed. Even if
>> there is no reference to it anywhere there are still ways to get hold of it,
>> for example by calling processes/0 or list_to_pid/1 (very naughty). Also in
>> a distributed node then other nodes may contain references to a process even
>> if there are no local references.
>> There are some things in Erlang which are not collected, for example pids,
>> ets tables and modules.
>> ----- "Tony Hannan" <> wrote:
>> > Hello,
>> > Does an orphaned waiting process get garbage collected? By orphaned I
>> > mean
>> > no one references it (no one has its pid) so it will never receive
>> > anymore
>> > messages. By waiting I mean it is waiting for a message inside a
>> > receive.
>> > For example,
>> > Wait = fun() -> receive _ -> 0 end end.
>> > spawn(Wait).
>> > Will that spawned process live and wait forever even though we did
>> > not
>> > capture its pid and thus can't send messages to it, or will it be
>> > garbage
>> > collected eventually?
>> > Thanks,
>> > Tony
More information about the erlang-questions