file:read_file in R7B

matthias@REDACTED matthias@REDACTED
Thu Nov 16 15:24:19 CET 2000


Miguel Barreiro Paz writes:

 > 	file:read_file/1 under R7B takes up an insane amount of memory,
 > while it seemed to be far more reasonable in R6B. Is this a known
 > bug? (or, probably, am I missing something?)

Can you be a bit more specific about the problem, e.g. how big is the
file you're reading, how are you measuring memory, and what
constitutes an "insane" amount?

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.

Matthias



More information about the erlang-questions mailing list