4 ms·
You can put your nif ref into a persistent term (if you do not plan to update it). Or into ETS table (which kinda defeats the purpose of making your own ETS tab
by octacat 3y ago
You can put your nif ref into a persistent term (if you do not plan to update it).
Or into ETS table (which kinda defeats the purpose of making your own ETS table).
But probably you would wanna not use resources and pass name of a table as an atom into your C level.
Lifecycle is simple, the same lifecycle is as for long binaries. Each process that saw the reference would increase internal ref count. Once a process has been GC-d and does not have references to the resource in the process heap - the ref count decreases. When nobody references the resource - it is removed.