[erlang-questions] EPmail-0.1 released

Alain O'Dea alain.odea@REDACTED
Fri Jan 28 17:29:36 CET 2011


On 2011-01-28, at 4:40, Max Lapshin <max.lapshin@REDACTED> wrote:

> Really, this code:
> 
> accept(Socket) ->
>    case gen_tcp:accept(Socket) of
>    {ok, Sock} ->
>         spawn(?MODULE, receive_loop, [Sock, [], []]),
>             gen_tcp:send(Sock, "+OK POP3 server ready \r\n"),
>           accept(Socket);
>    {error, Reason} ->
>        Reason
>    end.
> 
> 
> isn't suitable for production. You should start all processes via
> supervisors to keep track of them.
> If you start just plain spawn/spawn_link, you risk to loose process
> and get memory leak.

Alexander has planned to address this in the next version by using a supervisor and possibly gen_event child processes.  He is reading through Erlang and OTP in Action now :)

Memory leaks are a another very important motivation for this refactor.  Thank you Max :)


More information about the erlang-questions mailing list