[erlang-questions] Removing eterm from NifEnv.
Mon Nov 20 08:05:15 CET 2017
On Sat, Nov 18, 2017 at 8:20 PM, Ilya Khaprov <ilya.khaprov@REDACTED>
> I copy (enif_make_copy) an eterm to private NifEnv inside Nif.
> Later I want to remove that eterm from the NifEnv (actually I want to free
> memory, but I guess this means removing from NifEnv’s heap).
> How to do this? I know about enif_free_env, but this function clear entire
It is not possible to free an individual term from a nif environment. If
you want to have that kind of granularity, you have to create one
environment per term that you want to individually collect. If the
allocation cost of a new env is too large for your application, you could
pool env's and use enif_clear_env to re-cycle env's into the pool.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions