[erlang-questions] Safe way to cache atoms in NIF: driver_mk_atom replacement

Jeff Schultz <>
Fri May 4 16:51:40 CEST 2012


On Fri, May 04, 2012 at 03:35:17PM +0200, Lukas Larsson wrote:
> If I understand you correctly the answer is yes.

> I think the crypto implementation[1] does exactly this and since
> Sverker wrote both crypto and the NIF support I would say that it is
> safe :)

> On Fri, May 4, 2012 at 3:22 PM, Max Lapshin <> wrote:
> > Is there a way to cache atoms in NIF?

> > Is it ok just to store in static variable result of enif_make_atom ?

Seems unlikely to remain true if EEP20 or atom GC is ever implemented.
It would be quite a chore to find all such instances then.


    Jeff Schultz



More information about the erlang-questions mailing list