memory insanity

Matthias Lang <>
Fri Sep 14 10:08:04 CEST 2001


Hi,

Using R7B-3, this program bloats at a rate of about 100k per second on
my intel linux box. It does similar things on my PPC board. I've
watched it go up to 20Mb (using 'top') before stopping it.

I'd much appreciate it if a few people could confirm this result, a
result from a commercial solaris version would be interesting too.

Run it in the same directory as the .beam (it reads the .beam file):

  leaky:go().

Matthias

----------------------------------------------------------------------
-module(leaky).
-author('').

-compile(export_all).
-record(state, {eth_curr, eth_prev}).

go() -> loop(#state{}).

loop(State) ->
    State1 = update_ethernet(State), 
    erlang:garbage_collect(),
    loop(State1).

update_ethernet(State) ->
    Bin = grab_eth(),
    Prev = State#state.eth_curr,
    State#state{eth_curr = {now(), Bin}, eth_prev = Prev}.

grab_eth() ->
    {ok, IF} = file:open("leaky.beam", [raw, binary, read]),
    {ok, Bin} = file:read(IF, 2000),
    ok = file:close(IF),
    Bin.




More information about the erlang-questions mailing list