<div><div dir="auto">Sverker,</div><div dir="auto"><br></div><div dir="auto">Okay thanks for the clarifications.</div><div dir="auto"><br></div><div dir="auto">How about the opposite: an Erlang process which holds pointers to a large number of RefCounted </div><div dir="auto">Bins ?</div><div dir="auto"><br></div><div dir="auto">Is there any performance penalty (ex. affected by GC) of doing that?</div><div dir="auto"><br></div><div dir="auto">/Frank</div><div dir="auto"><br></div><br><div class="gmail_quote"><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<br>
On 09/20/2017 06:39 PM, Frank Muller wrote:<br>
> Thanks again Dmytro for your time.<br>
><br>
> Let assume I’m inside my NIF and would like to increment the refcount of a<br>
> binary (hope this is the right call: enif_keep_resource).<br>
No, enif_keep_resource does not work on binaries.<br>
"Resources" are a concept of their own and binaries are not resources.<br>
<br>
Unfortunately there is no enif_keep_binary. The only use for such a function<br>
is if you want to keep binaries alive even no processes are referring to<br>
them.<br>
And you would need some native data structure with pointers to those<br>
binaries,<br>
in order to find them without a binary term.<br>
<br>
/Sverker<br>
<br>
<br>
</blockquote></div></div>