<div dir="ltr"><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>because if we get to destructor without calling erlang destructor, it means that we need to reboot whole program and after 5 times reboot whole device with power cycle.</div><div><br></div></div></blockquote><div>OK, this brings me a bit back to previous discussion about enif_release_resource. If you do not call enif_release_resource in the same function as when you do enif_allocate_resource but wait until you have cleaned everything up with the  killing process ("erlang destructor") you will make sure that garbage collection and destructor call will not happen before this.  <br></div></div></div>