[erlang-questions] binary_part/3
Alex Alvarez
alex@REDACTED
Sun Jan 7 19:34:38 CET 2018
Okay, maybe I'm totally confused here, but is it a pointer to the
original binary or a new binary? Looking at the source code it seems
to build/make a new binary at the end of erts_gc_binary_part(). And
from the shell...
1> A = .
2> B = erlang:binary_part(A, 0, 8).
3> f(A).
ok
4> B.
A is gone and we still have B. Does Erlang actually returns
references?
Cheers,
Alex
On 1/7/2018 at 1:21 PM, "Frank Muller" wrote:Thank you Roger!!!
It's a sub-binary:
https://github.com/erlang/otp/blob/master/erts/emulator/beam/erl_bif_binary.c#L1915-L1924
On 6 January 2018 at 21:38, Frank Muller wrote:
> Hi Everyone
>
> Is the binary returned when calling binary_part/3:
> 1. a sub-binary pointing to the original one
> 2. or a new binary
>
> Thank you.
> Frank
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20180107/a055f3bc/attachment.htm>
More information about the erlang-questions
mailing list