Re:What Happens to OO When Processors Are Free? (2015)
by stormpat on Monday January 16, 2017 @01:39PM
(#13411912)
{_, mem} = :erlang.process_info(spawn(fn -> 1 + 1 end), :memory)
mem -> 2720 bytes (~2.7kb)
Re:What Happens to OO When Processors Are Free? (2015)
by strmpnk on Monday January 16, 2017 @02:16PM
(#13412179)
Which is pretty close to 338 words on a 64bit system (338*8). Looks like it's taking 2 extra words there though. Curious.
Re:What Happens to OO When Processors Are Free? (2015)
by masklinn on Tuesday January 17, 2017 @11:09AM
(#13418661)
Erlang/OTP 19 [erts-8.1] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]
Eshell V8.1 (abort with ^G)
> {memory, Mem} = erlang:process_info(spawn(fun () -> 1 + 1 end), memory).
{memory,2704}
> Mem div erlang:system_info(wordsize).
338
338 words is what the "Advanced: Memory" guide lists: http://erlang.org/doc/efficiency_guide/advanced.html> Erlang process 338 words when spawned, including a heap of 233 words.
However note that this is with HiPE and SMP enabled (which afaik are now the default) as the "processes" guide notes[0] without both of these a process should be 309 words. Without SMP, I get 320 words (HiPE is a compilation flag and I don't feel like recompiling Erlang right now).
For reference/comparison, by default with SMP and HiPE enabled an Erlang process is initialised at 338 words, including 233 words of heap memory (which contains the stack and will increase as needed) and the rest being process meta-information.
96KB private memory means you'd probably want to have "nursery" cores and process migration.