[erlang-questions] demonitor

Claes Wikstrom <>
Fri Aug 22 13:56:55 CEST 2008


I just recently discovered some bugs in the ssh application.
basically it's a code like in gen.erl

             erlang:demonitor(Mref),
             receive
                 {'DOWN', Mref, _, _, _} ->
                     {ok, Reply}
             after 0 ->
                     {ok, Reply}
             end;



The flushing wasn't there in the ssh app, and thus the DOWN messages
got accumulated and there was a memory leak. (I posted to erlang-patches)

Anyway, here is my question.

Don't you _always_ want to do that flushing after demonitor. And if
so, shouldn't the BIF do that. I bet there is whole lot of code
out there which doesn't properly do the flush.

/klacke



More information about the erlang-questions mailing list