[erlang-questions] Why is there an atom table?

Pierre Fenoll pierrefenoll@REDACTED
Sat Jul 20 16:12:41 CEST 2013


Hi,

So, atoms are stored in a shared table, using locks to read & write, and
never garbage-collected.
Well we know the issues that emerge from this.

What I can't find on the Web is the purpose of this table.
Why does Erlang needs to assign a unique hash to a <255-characters string
and put it in memory?

I thought atoms were just like enums, thus the only actions needed on them
were ==, =:= and the various conversions to string or binary.
An atom (approximately) corresponds to this regexp:
[a-z'][a-zA-Z0-9_']{,254}.
Its syntactic representation **already** supports the actions I cited.

Why not get rid of the atom table and and just use strncmp(3)?

Cheers,
Pierre
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130720/6a261a04/attachment.htm>


More information about the erlang-questions mailing list