-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Description
elixir/lib/elixir/src/elixir_code_server.erl
Line 132 in d8a533d
| {list_to_atom("elixir_compiler_" ++ integer_to_list(I)), I}. |
Environment
$ iex
Erlang/OTP 20 [erts-9.1] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:10] [hipe] [kernel-poll:false]
Interactive Elixir (1.5.2) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)>
Our use case
We using beam as a specific cache for database, we need compile some given modules to load the latest data from db to beam in interval time during runtime. Using:
Kernel.ParallelCompiler.files_to_path(source_files, beam_path)
Current behavior
create one new module and one atom per compilation, the atom just like:
elixir_compiler_8
elixir_compiler_7
elixir_compiler_6
elixir_compiler_5
elixir_compiler_4
elixir_compiler_3
elixir_compiler_2
and the module just like:
=mod:elixir_compiler_0
Current size: 0
Old size: 5193
Old attributes: 836C00000001680264000376736E6C000000016E1000E98FE57BEC2C0B4635218BB1ED55D6CF6A6A
Old compilation info: 836C0000000368026400076F7074696F6E736C0000000164000E6E6F7761726E5F6E6F6D617463686A680264000776657273696F6E6B0005372E312E326802640006736F757263656B005D2F6F70742F747562692F636D735F736572766963652F6C69622F706F6C6963795F656E67696E652D342E312E35302F7372632F6C69622F706F6C6963795F656E67696E652F67656E2F67656E5F7365726965735F706F6C6963792E65786A
=mod:elixir_compiler_12
Current size: 0
Old size: 9748
Old attributes: 836C00000001680264000376736E6C000000016E1000DAC1E389C40641D4E01D37111B6418976A6A
Old compilation info: 836C0000000368026400076F7074696F6E736C0000000164000E6E6F7761726E5F6E6F6D617463686A680264000776657273696F6E6B0005372E312E326802640006736F757263656B00602F6F70742F747562692F636D735F736572766963652F6C69622F706F6C6963795F656E67696E652D342E312E35302F7372632F6C69622F706F6C6963795F656E67696E652F67656E2F67656E5F636F6E7461696E65725F706F6C6963792E65786A
=mod:elixir_compiler_4
Current size: 0
Old size: 9027
Old attributes: 836C00000001680264000376736E6C000000016E10009D8CADBE367736B8F3FAFE93BDEF7E5C6A6A
Old compilation info: 836C0000000368026400076F7074696F6E736C0000000164000E6E6F7761726E5F6E6F6D617463686A680264000776657273696F6E6B0005372E312E326802640006736F757263656B00512F6F70742F747562692F636D735F736572766963652F6C69622F706F6C6963795F656E67696E652D342E312E35302F7372632F6C69622F706F6C6963795F656E67696E652F736C696365732F6E362E65786A
just because there is limitation for module amount in Erlang, the Elixir/Erlang node will be crash when the module amount reach the limitation, the crash dump slogan is:
no more index entries in module_code (max=65536)
the detailed information is:
=hash_table:module_code
size: 51437
used: 48890
objs: 65536
depth: 3
=index_table:module_code
size: 65536
limit: 65536
entries: 65536
Attempt
I tried to modify the Erlang vm args just as ERL_MAX_PORTS, BUT I failed.
Because the limitation for module amount can't modify in Erlang, it is hard-code in:
https://github.com/erlang/otp/blob/master/erts/emulator/beam/module.c#L38
Thanks.