<div><div class="gmail_quote"><div>OTP team,</div><div dir="auto"><br></div><div dir="auto">Anyone can shed some light on this please?</div><div dir="auto"><br></div><div dir="auto">/Frank</div><div dir="auto"><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span style="font-family:Arial;font-size:13px">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 <span class="m_2417699851828048986pl-en">erts_gc_binary_part(). And from the shell...<br><br>1> A = <<"A cookie is yummy!">>.<br><<"A cookie is yummy!">><br>2> B = erlang:binary_part(A, 0, 8).<br><<"A cookie">><br></span>3> f(A).<br>ok<br>4> B.<br><<"A cookie">><br><br>A is gone and we still have B. Does Erlang actually returns references?<br><br>Cheers,<br>Alex</span><span style="font-family:Arial;font-size:13px"><br><br>On 1/7/2018 at 1:21 PM, "Frank Muller" <<a href="mailto:frank.muller.erl@gmail.com" target="_blank">frank.muller.erl@gmail.com</a>> wrote:<blockquote style="border-left:solid 1px #ccc;margin-left:10px;padding-left:10px"><div><div class="gmail_quote"><div>Thank you Roger!!!</div><div dir="auto"><br></div><blockquote class="gmail_quote" style="border-left:1px #ccc solid;padding-left:1ex;margin:0 0 0 .8ex">It's a sub-binary:<br>
<br>
<a href="https://github.com/erlang/otp/blob/master/erts/emulator/beam/erl_bif_binary.c#L1915-L1924" target="_blank">https://github.com/erlang/otp/blob/master/erts/emulator/beam/erl_bif_binary.c#L1915-L1924</a><br>
<br>
On 6 January 2018 at 21:38, Frank Muller <<a>frank.muller.erl@gmail.com</a>> wrote:<br>
> Hi Everyone<br>
><br>
> Is the binary returned when calling binary_part/3:<br>
> 1. a sub-binary pointing to the original one<br>
> 2. or a new binary<br>
><br>
> Thank you.<br>
> Frank<br>
><br>
> _______________________________________________<br>
> erlang-questions mailing list<br>
> <a>erlang-questions@erlang.org</a><br>
> <a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
><br>
</blockquote></div></div></blockquote></span></blockquote></div></div>