file:read_file in R7B

Arndt Jonasson arndt@REDACTED
Thu Nov 16 17:22:30 CET 2000


In article <14867.60947.460693.451287@REDACTED>,
 <matthias@REDACTED> 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])
does.

-- 
Arndt Jonasson              Ericsson Utvecklings AB
arndt@REDACTED      ÄT2/UAB/F/P
+46 8 719 75 87             126 25 Stockholm



More information about the erlang-questions mailing list