[erlang-questions] Dynamically generated atoms get reused if they are the same?

Zvi <>
Thu Nov 8 21:05:21 CET 2007


Hi,

is this a wise idea to implement English->English dictionary using atoms?
(the other choice is binaries, lists are out of question, since they taking
16 words/character on 64bit machine).
Example of such a dictionary is mapping a word to the list of synonymous
words, i.e:

get_synonims(job) -> [work,task,gig].

Of course after dictionary once filled, only list_to_existing_atom will be
used and let's say there is maximum 100K words.

Thanks in advance,
Zvi



Kostis Sagonas-2 wrote:
> 
>  wrote:
>> Hi,
>> 
>> According to http://www.erlang.org/doc/efficiency_guide/bif.html#6.1
>> atoms do not get garbage collected. Meaning if you constantly produce
>> atoms by using list_to_atom/1 you sooner or later will run out of space
>> for them.
>> 
>> Now I just wrote a small test program which indicates that as long as you
>> produce the same atom, it will not take up additional space:
>>
>> So, can anyone confirm, is it correct that dynamically generated Atoms
>> are of no concern as long as you do not produce too many _different_
>> ones?
> 
> Yes, of course.
> 
> Kostis
> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions
> 
> 

-- 
View this message in context: http://www.nabble.com/Dynamically-generated-atoms-get-reused-if-they-are-the-same--tf4754859.html#a13654685
Sent from the Erlang Questions mailing list archive at Nabble.com.




More information about the erlang-questions mailing list