<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Apr 13, 2015 at 10:43 AM, Daniel <span dir="ltr"><<a href="mailto:liudanking@gmail.com" target="_blank">liudanking@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class=""><div class="h5"><br>
> On Apr 13, 2015, at 3:28 PM, Lukas Larsson <<a href="mailto:garazdawi@gmail.com">garazdawi@gmail.com</a>> wrote:<br>
><br>
> Hello Daniel,<br>
><br>
> On Mon, Apr 13, 2015 at 3:13 AM, Daniel <liudanking@<br>
><br>
> So my question is:<br>
> Does it means that  I meat a ‘classic' memory fragmentation problem? If YES, how can I free the fragment memory to OS?Because my ejabberd have been killed by Linux OOM for several times. If NO, what cause the memory increase all the time?<br>
><br>
> Would you mind checking how much of the binary_alloc memory is part of the mbc pool? ("erlang:system_info({allocator,binary_alloc}).", look for mbcs_pool). If it is very large you may have hit the bug described in OTP-12323, which has been fixed in Erlang/OTP 17.4. The scenario you are describing where the memory utilization constantly decreases sound very similar to what the bug fixed. If you don't want to upgrade to 17.4, you can also disable the pool in 17.3.<br>
><br>
> Lukas<br>
<br>
</div></div>Hi, Dear Lukas and list,<br>
<br>
Currently, linux *top* shows that beam.smp reserves 6.5GB memory , recon_alloc:memory(allocated) outputs 6.5GB and recon_alloc:memory(usage) outputs 0.0969.<br>
<br>
Bellow is my binary_alloc memory of mbcs_pool:<br>
<br><<< -- cut -- >>><br>
            {mbcs_pool,[{blocks,52044},<br>
                        {blocks_size,22538272},<br>
                        {carriers,115},<br>
                        {carriers_size,792723456}]},<br><<< -- cut -- >>><br>
            {mbcs_pool,[{blocks,139776},<br>
                        {blocks_size,35429768},<br>
                        {carriers,752},<br>
                        {carriers_size,5443158016}]}, </blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><<< -- cut -- >>><br>
mbcs_pool cost (5443158016 + 792723456) bytes (5.8GB) memory.</blockquote></div><br></div><div class="gmail_extra">From this data I'm pretty sure that you are hitting the bug I mentioned. So either upgrade to 17.4 or disable the pool (+Muacul 0) and your issue should go away. For a detailed description of the problem see this: <a href="https://github.com/erlang/otp/blob/master/erts/emulator/internal_doc/CarrierMigration.md#searching-the-pool">https://github.com/erlang/otp/blob/master/erts/emulator/internal_doc/CarrierMigration.md#searching-the-pool</a></div><div class="gmail_extra"><br></div></div>