Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Limit in the number of atoms

Tags:

erlang

elixir

In Erlang/OTP the number of atoms you can create is limited to 1,048,576, and it's not garbage collected. It is stated in the gen_server docs that atoms are not garbage collected, but I cannot find out if there is a limit.

Does Elixir have a limit as well? And if so what is it?

like image 367
ipinak Avatar asked Nov 25 '16 10:11

ipinak


People also ask

What are the limits of atoms?

An atomic limit is a band structure admitting a set of exponentially Localized Wannier functions respecting all the symmetries of the crystal and possibly time reversal. When the atomic separation is taken to infinity, these Wannier functions coincide in most cases with localized atomic orbitals.

Is there a limit to number of elements?

It is unknown how far the periodic table might extend beyond the known 118 elements, as heavier elements are predicted to be increasingly unstable. Glenn T. Seaborg suggested that practically speaking, the end of the periodic table might come as early as around Z = 120 due to nuclear instability.

Is there a limit to how many electrons in an atom?

No known element has more than 32 electrons in any one shell. This is because the subshells are filled according to the Aufbau principle. The first elements to have more than 32 electrons in one shell would belong to the g-block of period 8 of the periodic table.

Why is there a limit to the number of elements?

There can be no more than 137 elements. This limitation of the number of elements follows from the fact that there is a maximum speed in the Universe. That is, from the limit of the speed of light in a vacuum... Content may be subject to copyright.


1 Answers

Elixir runs on the same virtual machine as Erlang, and it's thus subject to the same atom limits as Erlang.

You can check the current limit with :erlang.system_info(:atom_limit), and you can change the limit by passing the +t flag to the Erlang virtual machine, using --erl to let the flag through to Erlang:

$ elixir -e 'IO.inspect :erlang.system_info(:atom_limit)'
1048576
$ elixir --erl "+t 2000000" -e 'IO.inspect :erlang.system_info(:atom_limit)'
2000000

However, if you find yourself running out of atoms, you should probably try solving the problem in another way.

like image 120
legoscia Avatar answered Sep 18 '22 13:09

legoscia