Maximum number of spawns?

2,246 views
Skip to first unread message

Matty Williams

unread,
Jun 17, 2013, 5:14:15 PM6/17/13
to elixir-l...@googlegroups.com
Sorry if the below is a bit daft, I'm very new to elixir:

I'm just doing some playing around, trying to see how much I can spawn. When I run this code:

I get the following error

=ERROR REPORT==== 17-Jun-2013::22:09:20 ===
Too many processes

** (SystemLimitError) a system limit has been reached
    :erlang.spawn(Main, :thread, [#PID<0.2.0>])

I guess 1000000 spawns is too many? I didn't think they were os processes, how is the maximum set? is there a way I can find the maximum?

While I'm here any comments/ observations about the code in general are fine - I'm learning after all!

Thanks

Matt

Eric Merritt

unread,
Jun 17, 2013, 5:26:51 PM6/17/13
to elixir-l...@googlegroups.com
They are very much not os processes. You wouldn't be getting any where
close to a million if they where.

Back in the day the default limit was 262143. I am not sure if that
remains the case. The reason they set that limit has more to do with
detecting errors and limiting memory consumption then actual hard
limits in the vm. In erlang at least, you can increase the maximum
processes by adding a +P <number of processes> to the command line
args. Unfortunately, it doesn't look like Elixir supports that flag,
but someone with more Elixir knowledge will have to respond.

Eric
> --
> You received this message because you are subscribed to the Google Groups
> "elixir-lang-talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to elixir-lang-ta...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

José Valim

unread,
Jun 17, 2013, 5:31:22 PM6/17/13
to elixir-l...@googlegroups.com
Thanks Eric. Complementing your response, any Erlang flag can be passed down to Elixir via ELIXIR_ERL_OPTS environment variable or via the --erl switch in the command line. For example:

    elixir --erl "+P 5000000" file/to/run.exs
    ELIXIR_ERL_OPTS="+P 5000000" elixir file/to/run.exs


José Valim
Skype: jv.ptec
Founder and Lead Developer

Matty Williams

unread,
Jun 17, 2013, 6:11:34 PM6/17/13
to elixir-l...@googlegroups.com
Eric, José

Thanks for replying so fast. I'll give it a try.

Thanks

Matt
Reply all
Reply to author
Forward
0 new messages