file:read_file in R7B

Arndt Jonasson <>
Thu Nov 16 17:22:30 CET 2000

In article <>,
 <> wrote:
> [...]
>One way which R7 differs from R6 is that many things involving
>binaries execute very slowly (and gobble memory) **in the shell**. For
>instance, doing
>   {ok, Bin} = file:read_file("/usr/share/dict/words").
>in the shell causes my beam emulator to jump to about 20Mb. Doing the
>same thing in a program, or even in different way in the shell:
>   {ok, Bin} = file:read_file("/usr/share/dict/words"), z.
>does not show unexpected memory consumption. 
>Taking a guess, this is because the shell has an interpreter for
>binary operations.

There have been other wrong guesses too. I experimented a little, and
it seems to be the case that
	io:format("~P", [Largebinary, 40])
does not consume immense amounts of memory, while
	io:format("~P", [{ok, Largebinary}, 40])

Arndt Jonasson              Ericsson Utvecklings AB
+46 8 719 75 87             126 25 Stockholm

More information about the erlang-questions mailing list