are function parameters copied?

Yani Dzhurov <>
Tue Jul 4 15:42:30 CEST 2006


Hi,

 

I've wondered whether functions share memory or for a function call new
memory is allocated and parameters are copied ?

This is what I mean:

fun()->

            Record = #some_record{},

            fun1(Record).

 

fun1(Record)->

            fun2(Record).

fun2(Record)->

            fun3(Record).

.fun3(Record)->

            fun4(Record).

fun4(Record)->

            Some operations with records:.

 

Is the VM going to copy Record four times for each function call or all
functions will share this object Record:having in mind that it's immutable
this shouldn't be a problem?

 

Thanks,

 

Jani

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20060704/47f237a9/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/20060704/47f237a9/attachment.bin>


More information about the erlang-questions mailing list