>From the documentation located at:<br><a href="http://erlang.org/doc/apps/erl_interface/ei_users_guide.html#id59377">http://erlang.org/doc/apps/erl_interface/ei_users_guide.html#id59377</a><br><br>Part: Example of Receiving Messages<br>
<br>Sample code is:<br><pre>ETERM *arr[2], *answer;
int sockfd,rc;
char buf[BUFSIZE];
ErlMessage emsg;
if ((rc = erl_receive_msg(sockfd , buf, BUFSIZE, &emsg)) == ERL_MSG) {
arr[0] = erl_mk_atom("goodbye");
arr[1] = erl_element(1, emsg.msg);
answer = erl_mk_tuple(arr, 2);
erl_send(sockfd, arr[1], answer);
<u><b> erl_free_term(answer);</b></u>
erl_free_term(emsg.msg);
erl_free_term(<a href="http://emsg.to">emsg.to</a>);
} <br><br>why erl_free_term() instead of erl_free_compound ?<br>From my own tests erl_free_term() is not enough...<br><br>I then think that this code leaks memory.<br><br>Maybe I'm completely wrong ?<br><br></pre>
<br>