Tue Mar 28 09:32:01 CEST 2006
[mailto:] On Behalf Of Yani Dzhurov
> Tree = gb_tree(),
> 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
[*] for binaries of size < 64, sent as messages.
More information about the erlang-questions