<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
(Sorry, missed the subject -- you are indeed talking about a C node.
Please ignore some of my previous phrasing.)<br>
<br>
<div class="moz-cite-prefix">On 08/09/14 10:34, Guilherme Andrade
wrote:<br>
</div>
<blockquote cite="mid:540D782F.9020402@gandrade.net" type="cite">
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
Hi Drod,<br>
<br>
Assuming your application is a C node, and that the library
codebase is the same as for NIFs and whatnot, I'd expect that
allocating structures / copying data is the appropriate behaviour
when creating Erlang terms -- it's the simple way to transfer that
data back to Erlang avoiding ownership issues and mutable state
(or at least making it much harder to unintentionally do it.)<br>
<br>
I've only dealt with NIFs though, and am not an expert on them, so
probably someone else can probably clarify this better.<br>
<br>
<br>
Cheers,<br>
<br>
<div class="moz-cite-prefix">On 08/09/14 10:08, Dror Mein wrote:<br>
</div>
<blockquote
cite="mid:1410167335.29492.YahooMailNeo@web126701.mail.ne1.yahoo.com"
type="cite">
<div style="color:#000; background-color:#fff;
font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial,
Lucida Grande, sans-serif;font-size:12pt">
<div>Hi all,</div>
<div>I'm writing a c application that communicates with an
erlang node. In order to send messages to the node I need to
create erlang terms (ETERM structure).</div>
<div>it appears that all functions in the C library
"erl_eterm" allocate memory when creating erlang terms. </div>
<div>For example, erl_mk_binary copies the binary provided to
it, instead of only creating the pointer.</div>
<div>I want to prevent this memory allocation to optimize
speed. </div>
<div>Has anyone done this before? </div>
<div>Is there a better way to create eterms?</div>
<div><br>
</div>
<div style="color: rgb(0, 0, 0); font-size: 16px; font-family:
HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida
Grande', sans-serif; font-style: normal; background-color:
transparent;">Thanks</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
erlang-questions mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://erlang.org/mailman/listinfo/erlang-questions">http://erlang.org/mailman/listinfo/erlang-questions</a>
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Guilherme
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="https://www.gandrade.net/">https://www.gandrade.net/</a>
PGP: 0x35CB8191 / 1968 5252 3901 B40F ED8A D67A 9330 79B1 35CB 8191
</pre>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
erlang-questions mailing list
<a class="moz-txt-link-abbreviated" href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a>
<a class="moz-txt-link-freetext" href="http://erlang.org/mailman/listinfo/erlang-questions">http://erlang.org/mailman/listinfo/erlang-questions</a>
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Guilherme
<a class="moz-txt-link-freetext" href="https://www.gandrade.net/">https://www.gandrade.net/</a>
PGP: 0x35CB8191 / 1968 5252 3901 B40F ED8A D67A 9330 79B1 35CB 8191
</pre>
</body>
</html>