Erlang VM
Vlad Dumitrescu
vlad_dumitrescu@REDACTED
Tue Mar 28 09:32:01 CEST 2006
Hi!
> From: owner-erlang-questions@REDACTED
[mailto:owner-erlang-questions@REDACTED] On Behalf Of Yani Dzhurov
>
> my_fun()->
> Tree = gb_tree(),
> .,
> foo(),
> bar(),
> baz().
> And if a "spawn" this function into a hundred of processes will the
Erlang VM machine create hundred of gb_trees, or it will create just one
instance and a hundred references to it. Sorry if my question is pretty
stupid but I'm very familiar with Erlang.
There will be a different gb_tree for each process. Processes have separate
data heaps. Some sharing is possible [*], but that's just an optimization.
Even if you do
Tree = gb_tree(),
spawn(fun() -> my_fun(Tree) end),
With an appropriately changed my_fun, each process still receives a copy of
Tree.
[*] for binaries of size < 64, sent as messages.
Best regards,
Vlad
More information about the erlang-questions
mailing list