memory insanity

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

memory insanity

Matthias Lang-2
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('matthias').

-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.



Reply | Threaded
Open this post in threaded view
|

memory insanity

Robert Virding-4
Matthias Lang <matthias> writes:

>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

I tried it with new R8a test release and there were no problems
there.  The memory usage stayed happily at 4904 Mb for a few minutes.

        Robert


Reply | Threaded
Open this post in threaded view
|

memory insanity

Bruce Fitzsimons-2
In reply to this post by Matthias Lang-2
Using R7B-3 on an intel box with 160MB ram, its at 50M after 3m 30s and
still going...

Using otp_src_P8A-20010902-SNAPSHOT (not the most recent, not using HiPE) on
the same box, its stable at about 4M (no change after startup).

So it looks like there was a leak in R7B-3 and it has been fixed.

Cheers,
Bruce




Reply | Threaded
Open this post in threaded view
|

memory insanity

Raimo Niskanen-3
In reply to this post by Matthias Lang-2
There is a leak in R7B-3 that leaks some 40 bytes per closed file. Patch
follows.

***
erts/emulator/drivers/common/efile_drv.c@@/main/release/r7b01_patch/OSE_R7B-3      
Fri May 18 16:41:09 2001
---
erts/emulator/drivers/common/efile_drv.c@@/main/release/r7b01_patch/LATEST
Mon Aug 27 18:50:44 2001
***************
*** 222,228 ****
        d->command = FILE_CLOSE;
        DRIVER_ASYNC(2, desc, KEY, invoke_close, (void *) d,
                     free_data);
-       return 0;
      }
  #endif
      }
--- 222,227 ----

/ Raimo Niskanen, Erlang/OTP, Ericsson UAB.



Matthias Lang wrote:

>
> 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('matthias').
>
> -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.