[erlang-questions] Internal compiler atoms

Anthony Ramine <>
Tue Aug 1 13:58:08 CEST 2017


> Le 27 juil. 2017 à 16:19, Håkan Mattsson <> a écrit :
> 
> 
> I am trying to compile a ​(​big​)​ module from a list of forms​​, but it seems​ like the compiler internally generates lots of new atoms:​
> 
> no more index entries in atom_tab (max=1048576)
> 
> Crash dump is being written to: erl_crash.dump...
> 
> ​In this case the compiler itself generated ​more than 300K atoms while compiling my forms.
>> ​Why is the atoms generated?​
> 
> ​Is this anything that can be disabled?​
> 
> /Håkan

Write a core_transform that replaces all atoms in c_vars by integers. Given the Core inliner already emits variables named after integer values, the rest of the Core compiler passes should be able to cope with them.

> 
> Le 28 juil. 2017 à 08:43, Albin Stigö <> a écrit :
> 
> 4. If you really DO need to create dynamic atoms for a quick and dirty
> hack, keep in mind that atoms with a common prefix ie. foo_1, foo_2,
> foo_3 etc will lead worse performance because of how erlang compares
> atoms (some Erlang guru correct me if I'm wrong but this used to be
> the case).

Wrong, atom comparison is always O(1).




More information about the erlang-questions mailing list