<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Hello<br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On 19 Apr 2019, at 17.39, Filip Niksic <<a href="mailto:fniksic@seas.upenn.edu" class="">fniksic@seas.upenn.edu</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><span style="caret-color: rgb(0, 0, 0); font-family: verdana, sans-serif; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">Now, it has to be noted that one of the arguments to the spawned process is a function closure. Could it be that this closure causes the runtime to pack all of its data structures and pass them along with the message? If so, how can such a situation be avoided? Is there some general rule of thumb that function closures should not be passed as arguments in a distributed setting?</span></div></blockquote></div><br class=""><div class="">I would bet that usage of closure function is the major reason. Passing anonymous functions causes a serialisation of its entire environment. It might easily grow to 11MB.</div><div class=""><br class=""></div><div class="">Some hints and discussion can be found here</div><div class=""><a href="http://erlang.org/pipermail/erlang-questions/2008-November/039849.html" class="">http://erlang.org/pipermail/erlang-questions/2008-November/039849.html</a></div><div class=""><br class=""></div><div class="">The best practice to use fun Mod:Fun/N over fun() -> … end.</div><div class=""><br class=""></div><div class="">Best Regards,</div><div class="">Dmitry</div></body></html>