[erlang-questions] Regarding the life cycle of ERL_NIF_TERM

Xiaopong Tran xiaopong.tran@REDACTED
Thu Jun 7 11:06:28 CEST 2012


Hi,

I have a question regarding the life cycle of ERL_NIF_TERM. According to 
the Erlang document http://www.erlang.org/doc/man/erl_nif.html:

"All ERL_NIF_TERM's belong to an environment (ErlNifEnv). A term can not 
be destructed individually, it is valid until its environment is 
destructed."

And the description regarding the ErlNifEnv:

"A process bound environment is passed as the first argument to all 
NIFs. All function arguments passed to a NIF will belong to that 
environment."

Could someone clarify what that means exactly, in terms of the
ERL_NIF_TERM life cycle?

So, in this case, the environment is process bound. Does this
mean that, all ERL_NIF_TERM passed in a parameters to NIF function,
and the ERL_NIF_TERM return value, will never get GC, as long
as the process is running?

Cheers,


Xiaopong



More information about the erlang-questions mailing list