[erlang-questions] How to release term created by enif_make_copy

Sverker Eriksson <>
Mon Sep 20 14:29:24 CEST 2010


Late answer after long vacation:

caox wrote:
> Hi
>
> In my experiment of erlang nif, I use an global env to store term received from erlang proc  s via enif_make_copy(). I am wondering how could I free some specific terms created on this env but not all of them? 
>
> I didn't find any lib funcs to do this job. Both enif_clear_env() and enif_free_env() do whole cleanup, and enif_free is annotated to be used only for  memory allocated by enif_alloc.
>   

There is no way to free the memory of an individual term while keeping 
other terms in the same environment.

You would have to create the term with its own environment.

/Sverker, Erlang/OTP




More information about the erlang-questions mailing list