[erlang-questions] Garbage Collection, BEAM memory and Erlang memory

Lukas Larsson garazdawi@REDACTED
Fri Jan 23 18:03:16 CET 2015


Hello Roberto

On Fri, Jan 23, 2015 at 5:25 PM, Roberto Ostinelli <roberto@REDACTED>
wrote:

> It is only a hunch. Clearly, something is using more memory than you
>> expect, and I assume you have made calculations which shows that this
>> memory usage is excessive given the number of processes and the specific
>> profile of the system. Running 20000 SSL sockets will have some overhead
>> due to SSL, so it is important to figure out if the memory usage is normal
>> or unexpected in the first place.
>>
>
> The main question here is: why is there such a difference between what the
> BEAM uses, and what Erlang VM uses.
>

> In another (bigger) test I am now seeing erlang:memory reporting a total
> of 10 GB, while the BEAM eats up to 15 GB.
>
>
With a recon_alloc:memory(usage, current) value of 65 - 70%, this
difference is expected. What is happening is that the memory allocators of
the VM is not finding any good slots to put new heaps in, so it keeps
requesting more memory from the OS. erlang:memory reports used memory,
which is not the same as the memory requested from the OS.
recon_alloc:memory(allocated, current) reports something very close to what
has actually been requested from the OS, which is why this value is much
closer to what you see with top.

It would be interesting to see if you get the same results if you start the
VM with "+Muacul 0", or if you get better utlization if you use that. If
you want to know what it is that you are disabling you can read this:
https://github.com/erlang/otp/blob/master/erts/emulator/internal_doc/CarrierMigration.md
.

Lukas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20150123/d8be41ed/attachment.htm>


More information about the erlang-questions mailing list