[erlang-questions] nif resources

Sverker Eriksson sverker@REDACTED
Thu Jun 24 10:45:19 CEST 2010


Rapsey wrote:
> If a resource was created within a thread (and released with
> enif_release_resource), then sent to some erlang process. Will that erlang
> process have a handle to the resource (thus prevent it from being released)
> even if it did not save it anywhere (the variable for the resource was
> ignored)?
> This is the behavior I am seeing. Unless I kill the process which received
> the resource, it will never get released. Is there any way to make an erlang
> process release it's handle to the resource?
> I'm using R14A
>   
A resource that is not references by any Erlang process and totally 
released with enif_release_resource
should eventually be garbage collected like any other term.

Have you tried erlang:garbage_collect when verifying if the destructor 
is called?

/Sverker, Erlang/OTP



More information about the erlang-questions mailing list