[erlang-questions] nif resource lifetime

Benoit Chesneau <>
Tue Sep 5 18:58:43 CEST 2017

How do you manage the lifetime of a nif resource when it has been created and can be used by one another?

1) I an object O1 and expose it as a resource R1
2) I’m created R2 that need the object O1exposed by R1 by passing R1 as an argument to the nif function used to create R2

I would like to make sure that the object is not preemptively killed or garbaged collected. How would you do it? Any feedback is welcome :)

- benoît

More information about the erlang-questions mailing list