[erlang-questions] Unique atom with make_ref()?

Sean Cribbs seancribbs@REDACTED
Thu Feb 4 13:29:02 CET 2010


The primary reason you wouldn't want to create atoms dynamically is that 
they are not garbage collected.  If an attacker knows you do this, it 
should become pretty obvious how to take down your application.  I think 
it's reasonable to use a ref as a unique identifier, but I'd reserve 
atoms for symbolic names.

Sean

On 2/4/10 6:27 AM, Daniel Rönnqvist wrote:
> Hello,
>
> Why sholdn't I use erlang:ref_to_list/1 in application programs? As it
> says here:
>
> http://erlang.org/doc/man/erlang.html#erlang:ref_to_list-1
>
> Let's say that I wanted to create a unique atom, isn't this a good way?
>
> list_to_atom(erlang:ref_to_list(make_ref()))
>
> BR,
> Daniel Rönnqvist
>
> ________________________________________________________________
> erlang-questions (at) erlang.org mailing list.
> See http://www.erlang.org/faq.html
> To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
>
>
>    




More information about the erlang-questions mailing list