[erlang-questions] enif_free and free in a NIF

Lukas Larsson lukas@REDACTED
Fri Jul 4 00:06:22 CEST 2014


Hello,

On Thu, Jul 3, 2014 at 9:45 PM, Matthew Evans <mattevans123@REDACTED>
wrote:

>
> The question is is it safe to mix and match the Erlang memory
> allocation/deallocation NIF libraries with the standard Linux calls to free
> and malloc?
>
>
Depends on what you mean by mix and match. It is ok to allocate with both
malloc and enif_alloc in a nif as long as you deallocate with free and
enif_free respectively. It does not work to allocate with enif_alloc and
then deallocate with free.

Lukas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20140704/9a887bb6/attachment.htm>


More information about the erlang-questions mailing list