Does anybody knows how it exactly runs?<div><br><div><div>Best regards,</div><div>Max</div><br><br>
<br><br><div class="gmail_quote">2011/11/21 CGS <span dir="ltr"><<a href="mailto:cgsmcmlxxv@gmail.com">cgsmcmlxxv@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<u></u>

  
    
  
  <div text="#000000" bgcolor="#ffffff">
    Sorry for not being explicit. I was referring not only to the data,
    but also to the code itself. As far as I noticed, Erlang does not
    make any difference between loading the same module in different
    processes and different modules in different processes. Each process
    instance is independent and does not share any bit of its memory
    with other instances (it can copy, but does not share). I might be
    wrong in my observation, though (only a developer can be 100% sure).<br>
    <br>
    My test consisted in starting the same piece of code in two
    different Erlang sessions (processes as you call them) and I noticed
    the same memory consumption for each (top -d 1 -p <PID of the
    system process where your code is loaded>). You can test that as
    well and compare it with the beam size. As I said, I might be wrong
    because my code has a certain level of granularity which doesn't
    allow very large functions (I avoid large functions for better
    monitoring the states).<br>
    <br>
    I hope this answer will at least help you to convince yourself about
    which answer is correct.<span class="HOEnZb"><font color="#888888"><br>
    <br>
    CGS</font></span><div><div class="h5"><br>
    <br>
    <br>
    <br>
    <br>
    <br>
    On 11/21/2011 12:51 PM, Max Bourinov wrote:
    <blockquote type="cite">About the process data it isabsolutelyclean how
      Erlang handles it. I just want some clarification about the code.
      <div><br>
      </div>
      <div><br clear="all">
        <div>Best regards,</div>
        <div>Max</div>
        <br>
        <br>
        <br>
        <br>
        <div class="gmail_quote">2011/11/21 CGS <span dir="ltr"><<a href="mailto:cgsmcmlxxv@gmail.com" target="_blank">cgsmcmlxxv@gmail.com</a>></span><br>
          <blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
            <div text="#000000" bgcolor="#ffffff"> One instance per
              process, one memory allocation per process (even if it is
              the same code running). Erlang has no explicit knowledge
              of beam shared objects as far as I know. If somebody knows
              differently, please, correct me.<span><font color="#888888"><br>
                  <br>
                  CGS</font></span>
              <div>
                <div><br>
                  <br>
                  <br>
                  <br>
                  <br>
                  On 11/21/2011 12:40 PM, Max Bourinov wrote:
                  <blockquote type="cite">
                    <div>Thank you for your reply! But in Erlang
                      processes, not threads. There are some differences
                      between them...</div>
                    <div><br>
                    </div>
                    <div><br>
                      <br>
                        iPhone</div>
                    <div><br>
                      21.11.2011,  15:05, CGS <<a href="mailto:cgsmcmlxxv@gmail.com" target="_blank">cgsmcmlxxv@gmail.com</a>>
                      ():<br>
                      <br>
                    </div>
                    <blockquote type="cite">
                      <div> Hi, Max,<br>
                        <br>
                        Not an expert, but I think the memory is
                        multiplied by the number of threads. Meaning,
                        you start with an initial heap for that thread
                        and add to that the states and other internal
                        variables (repeat that for all the threads). At
                        least that I noticed from my codes by now. If I
                        am wrong, I apologize.<br>
                        <br>
                        Cheers,<br>
                        CGS<br>
                        <br>
                        <br>
                        <br>
                        <br>
                        On 11/21/2011 11:57 AM, Max Bourinov wrote:
                        <blockquote type="cite">Hi Erlangers,
                          <div><br>
                          </div>
                          <div>I am wondering how my Erlang app would
                            behave in this case:</div>
                          <div><br>
                          </div>
                          <div>I have a lot identical processes (the
                            same module, state of couse is different in
                            each process). The module that I swap many
                            times has a huge function. I want to clarify
                            how much memory it will take? It will take
                            memory for that huge function in each
                            process or only once?</div>
                          <div><br>
                          </div>
                          <div>I believe it will take memory only once,
                            but I want to make sure.</div>
                          <div><br clear="all">
                            <div>Best regards,</div>
                            <div>Max</div>
                            <br>
                            <br>
                          </div>
                          <pre><fieldset></fieldset>
_______________________________________________
erlang-questions mailing list
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a>
</pre>
                        </blockquote>
                        <br>
                      </div>
                    </blockquote>
                    <blockquote type="cite">
                      <div><span>_______________________________________________</span><br>
                        <span>erlang-questions mailing list</span><br>
                        <span><a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a></span><br>
                        <span><a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a></span><br>
                      </div>
                    </blockquote>
                  </blockquote>
                  <br>
                </div>
              </div>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </div></div></div>

</blockquote></div><br></div></div>