[erlang-questions] cnode interface memory allocation
Guilherme Andrade
g@REDACTED
Mon Sep 8 11:34:39 CEST 2014
Hi Drod,
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.)
I've only dealt with NIFs though, and am not an expert on them, so
probably someone else can probably clarify this better.
Cheers,
On 08/09/14 10:08, Dror Mein wrote:
> Hi all,
> 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).
> it appears that all functions in the C library "erl_eterm" allocate
> memory when creating erlang terms.
> For example, erl_mk_binary copies the binary provided to it, instead
> of only creating the pointer.
> I want to prevent this memory allocation to optimize speed.
> Has anyone done this before?
> Is there a better way to create eterms?
>
> Thanks
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
--
Guilherme
https://www.gandrade.net/
PGP: 0x35CB8191 / 1968 5252 3901 B40F ED8A D67A 9330 79B1 35CB 8191
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20140908/91000956/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 455 bytes
Desc: OpenPGP digital signature
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20140908/91000956/attachment.bin>
More information about the erlang-questions
mailing list