[erlang-questions] Am I leaking memory inside my linked in driver?

Serge Aleynikov serge@REDACTED
Tue Feb 26 01:40:21 CET 2013

The ei library in C doesn't implements atoms in the same way how Erlang
emulator does. I.e. there are no atom structures created or destroyed -
the atoms binary representation is encoded in external Erlang binary
format to the pointer pointed by ei_x_buff*.

So as long as you initialize the ei_x_buff using ei_x_new() and
deallocate it with ei_x_free() you are fine.

On 2/25/2013 7:10 PM, Zabrane Mickael wrote:
> Hi guys,
> If I keep calling ei_x_encode_atom(ei_x_buff* x, const char *p))
> (http://erlang.org/doc/man/ei.html#ei_x_encode_atom)
> again and again to create the same atom 'ok' ... am I leaking memory?
> Yes, I can create the atom 'ok' since the beginning as a static variable
> and use its reference.
> But want to be sure I'm leaking memory (or not) in the first case.
> Regards,
> Zabrane
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions

More information about the erlang-questions mailing list