[erlang-questions] How to tune erlang memory allocator to use 25 GB of ram and stop munmaping it?

Lukas Larsson <>
Tue Aug 20 17:04:41 CEST 2013


Hello Peer,

On Tue, Aug 20, 2013 at 12:43 PM, Peer Stritzinger <> wrote:

> My favorite behaviour would be for Erlang to either grab all memory
> available or at least a fixed amount on startup and hold on to it forever.
>  Hopefully without fragmenting it too much (I know in case of binary heaps
> that this isn't possible which is a bit disturbing to me).
>
> Can this be achieved by the current ERTS with some parameter settings?
>

You could request that the main mbc (+M<S>mmbcs) should be preallocated to
a certain size, and this would kind of get the effect you are looking for.
However this is controlled on a per allocator level, so you have to figure
out which type of memory it is that you are using. It also will only work
for any mbcs allocated, all sbcs will still be allocated using mmap/malloc.
If you want to force only mbcs you could up the sbct to very big, just
remember to up lmbcs as well so that can fit all of your sbcs into the mbc.

I do not recommend doing this, but it is possible.


> Which direction should I look if I want to add behaviour like this?
>
> BTW:  next best thing is to malloc/free allways same size tiles this would
> avoid outer fragmentation and could be sped up relatively easily.
>

The emulator already tries to do this to the best of its abilities. mbcs
mmap requests grow depending on how you setup lmbcs, smbcs and mbcgs.
sys_alloc (i.e. malloc) calls are always multiples of +Muycs.

You could set smbcs to the same as lmbcs if you want to, this makes it so
that all mbcs have that same size.

Lukas*
*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130820/55332f0f/attachment.html>


More information about the erlang-questions mailing list