memory insanity
Raimo Niskanen
raimo@REDACTED
Fri Sep 14 11:01:42 CEST 2001
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@REDACTED').
>
> -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