[erlang-questions] enif_alloc_resource and enif_release_resource

Daniel Goertzen daniel.goertzen@REDACTED
Mon Mar 12 03:44:29 CET 2012


Am I allowed to call enif_release_resource() immediately after
calling enif_alloc_resource().  The documentation suggests that I should be
calling enif_make_resource() in between, but I don't want to do that.

Furthermore, on a resource that I just allocated with enif_alloc_resource,
is there a way to release it without invoking the destructor?

I am working on a C++11 wrapper for resources.  In C++, if construction of
a dynamically allocated object throws an exception, the memory gets
deallocated without invoking the destructor.  I'm trying to reproduce that
in a nif resource.

Thanks,
Dan.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120311/3c7d8652/attachment.htm>


More information about the erlang-questions mailing list