[erlang-questions] Small and large (>=64B) binaries? How do they differ?

Sverker Eriksson sverker.eriksson@REDACTED
Thu Sep 21 12:10:56 CEST 2017



On 09/20/2017 06:39 PM, Frank Muller wrote:
> Thanks again Dmytro for your time.
>
> Let assume I’m inside my NIF and would like to increment the refcount of a
> binary (hope this is the right call: enif_keep_resource).
No, enif_keep_resource does not work on binaries.
"Resources" are a concept of their own and binaries are not resources.

Unfortunately there is no enif_keep_binary. The only use for such a function
is if you want to keep binaries alive even no processes are referring to 
them.
And you would need some native data structure with pointers to those 
binaries,
in order to find them without a binary term.

/Sverker





More information about the erlang-questions mailing list