[erlang-questions] Erlang and Memory management
Jesper Louis Andersen
Thu Jun 2 11:33:11 CEST 2011
On Thu, Jun 2, 2011 at 10:53, Wenqiang Song <> wrote:
> A related question, for code like following:
> test(<<255, T/binary>>) ->
> test(<<_, T/binary>>) ->
> Does Erlang copy the input binary for each recursion? If the input is huge,
> it would be very low efficient. If so, what should we do?
No. It just has a pointer into the existing binary. Immutability is nice :)
is the source you want to look at. Compile your code with the
bin_opt_info flag to see if optimizations trigger as well.
More information about the erlang-questions