sends don't block, right?

Chris Pressey <>
Wed Feb 25 05:19:09 CET 2004


On Tue, 24 Feb 2004 22:48:21 -0500
Shawn Pearce <> wrote:

> Ok, colo(u)r me stupid now (borrowed phrase, sorry!):
> 
> ! doesn't block, right?

Right.

> If I do something foolish like this:
> 
> 	never_end() ->
> 		Pid = spawn(fun() -> receive foo -> ok end),
> 		do_loop(Pid).
> 
> 	do_loop(Pid) ->
> 		Pid ! bar,
> 		io:format("still going, just like the bunny~n", []),
> 		do_loop(Pid).
> 
> will the parent ever stop because the child's message buffer is full?

No.  It'll crash.
By which I mean the Erlang *node* will crash, not just the process.

> Basically, I'm asking if Erlang will let the parent in this case run
> the VM out of memory before making the parent freeze.

Yes, exactly that.

At least, that was my experience last time I tried anything like this.
Perhaps try it yourself and see?

-Chris



More information about the erlang-questions mailing list