Erlang VM

Yani Dzhurov <>
Tue Mar 28 08:55:14 CEST 2006


Hi guys,

 

I wondered how the Erlang virtual machine works with creating a lot of alike
objects.

This is my function for example:

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.

 

As far as I know in Java, if I have

String a = "abc";

String b = "abc";

The Java VM will create just one object string "abc" and point both 'a' and
'b' to that object, since string is immutable and there would be no
collisions with using that object. In Erlang objects are immutable also,
right ? So will the Erlang VM do the same as the Java one?

 

Thanks,

 

Yani

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20060328/00dc5eb2/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3326 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20060328/00dc5eb2/attachment.bin>


More information about the erlang-questions mailing list