[erlang-questions] Questions about processes and message queues

Dominic Williams <>
Wed Feb 4 16:13:05 CET 2009

Hello again Nicola,

I suggested:

> Have you tried to see what happens if a process sends itself
> messages and never reads them? In the shell:
> 1> F = fun (G) -> self() ! hello, G(G) end.

This version crashes the VM a lot faster, because the messages
get bigger and bigger:

1> Fun = fun (M, F) -> F (self () ! [M | M], F) end.
2> Report = fun (Pid, R) -> io: fwrite ("~p~n", [erlang: process_info
(Pid, [memory, message_queue_len])]), timer: sleep (5000), R(Pid, R) end.
3> Report (spawn (fun () -> Fun ("hello", Fun) end), Report).


Dominic Williams

More information about the erlang-questions mailing list