Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Safe way to cache atoms in NIF: driver_mk_atom replacement
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Sverker Eriksson  
View profile  
 More options May 4 2012, 10:11 am
From: Sverker Eriksson <sver...@erix.ericsson.se>
Date: Fri, 4 May 2012 16:11:01 +0200
Local: Fri, May 4 2012 10:11 am
Subject: Re: [erlang-questions] Safe way to cache atoms in NIF: driver_mk_atom replacement
Currently atoms are independent of environment (ErlNifEnv). That is, you
can cache atoms by storing them in static variables as done in crypto.c.
This is an undocumented feature however.

To compensate for future possible introduction of atom-GC I have thought
of documenting this feature with some restriction. Something like

"Atoms created in load/upgrade callbacks are static and can be used in
any environment"

/Sverker, Erlang/OTP

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 :)

> Lukas

> [1] https://github.com/erlang/otp/blob/maint/lib/crypto/c_src/crypto.c#L300

> On Fri, May 4, 2012 at 3:22 PM, Max Lapshin <max.laps...@gmail.com> wrote:

>> Is there a way to cache atoms in NIF?

>> Is it ok just to store in static variable result of enif_make_atom ?
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questi...@erlang.org
>> http://erlang.org/mailman/listinfo/erlang-questions

> _______________________________________________
> erlang-questions mailing list
> erlang-questi...@erlang.org
> http://erlang.org/mailman/listinfo/erlang-questions

_______________________________________________
erlang-questions mailing list
erlang-questi...@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.