Allocation in erl_interface

Matthias Lang matthias@REDACTED
Thu Oct 20 11:57:37 CEST 2005


Corrado Santoro writes:

 > In the C program, I'm using erl_XXX function to extract data from 
 > incoming messages; I'm wondering if each call to a erl_XXX function 
 > (e.g. erl_element, erl_hd, erl_tail) perform a new allocation, so the 
 > return term must be then deallocated by means of erl_free_term.

I've never passed erlang terms to C programs; I prefer to let the
Erlang side adapt itself to C. But the manual says:

  | Normally it is the programmer's responsibility to free each Erlang
  | term that has been returned from any of the erl_interface
  | functions. 

See erl_free_term and erl_free_compound in

  http://erlang.se/doc/doc-5.4.8/lib/erl_interface-3.5.4/doc/html/erl_malloc.html#erl_free/1

Matthias



More information about the erlang-questions mailing list