io:format memory problem

Inswitch Solutions - Erlang Evaluation erlang@REDACTED
Sat Jan 18 17:00:05 CET 2003


Hello,

While executing this program, the memory increases constantly. But, if I comment the lines "io:format(.)" it doesn't happen (the memory stabilizes). Is this behaviour correct? 

1> example:start(1000).

-module(example).

-export([start/1, stop/0]).


start(Cant) ->
    init_process(Cant),
    register(?MODULE, spawn_link(fun() -> loop() end)).

stop() ->
     ?MODULE ! {stop}.
  
init_process(0) ->
    ok;
 
init_process(Cant) ->
    spawn_link(fun() -> proc() end),
    init_process(Cant - 1).

proc() ->
    io:fwrite("In proc~n", []),
    receive
      after 4000 ->
           io:fwrite("TimeOut~n", []),
           proc()
    end.

loop() ->
    receive
        {stop} ->
           io:format("Bye~n", []),
           ok
    end.

Thanks,

Bernardo.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20030118/9609574f/attachment.htm>


More information about the erlang-questions mailing list