Skip to content

Instantly share code, notes, and snippets.

@2garryn
Last active August 29, 2015 14:17
Show Gist options
  • Save 2garryn/6a63bea38c51dc7828cd to your computer and use it in GitHub Desktop.
Save 2garryn/6a63bea38c51dc7828cd to your computer and use it in GitHub Desktop.
1> F = fun(N) -> list_to_atom(integer_to_list(N)), timer:sleep(infinity) end.
17> [spawn(fun() -> F(N) end) || N <- lists:seq(1, 100000)].
[<0.751.0>,<0.752.0>,<0.753.0>,<0.754.0>,<0.755.0>,
<0.756.0>,<0.757.0>,<0.758.0>,<0.759.0>,<0.760.0>,<0.761.0>,
<0.762.0>,<0.763.0>,<0.764.0>,<0.765.0>,<0.766.0>,<0.767.0>,
<0.768.0>,<0.769.0>,<0.770.0>,<0.771.0>,<0.772.0>,<0.773.0>,
<0.774.0>,<0.775.0>,<0.776.0>,<0.777.0>,<0.778.0>,<0.779.0>|...]
18> erlang:memory(atom_used).
2255590
19> erlang:memory(atom).
2273257
20> [spawn(fun() -> F(N) end) || N <- lists:seq(1, 100000)].
[<0.2450.3>,<0.2451.3>,<0.2452.3>,<0.2453.3>,<0.2454.3>,
<0.2455.3>,<0.2456.3>,<0.2457.3>,<0.2458.3>,<0.2459.3>,
<0.2460.3>,<0.2461.3>,<0.2462.3>,<0.2463.3>,<0.2464.3>,
<0.2465.3>,<0.2466.3>,<0.2467.3>,<0.2468.3>,<0.2469.3>,
<0.2470.3>,<0.2471.3>,<0.2472.3>,<0.2473.3>,<0.2474.3>,
<0.2475.3>,<0.2476.3>,<0.2477.3>,<0.2478.3>|...]
21> erlang:memory(atom).
2273257
22> erlang:memory(atom_used).
2255590
23>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment