<div dir="ltr">Dominic, Thanks for your scripts . It has helped to identify issues with {binary_alloc,3140268032}, All the missing memory is allocated into binary_alloc.<div>We do using binary_to_term on 1 to 4 MB blob variables. Which version of OTP have you migrated to? We are also planning to migrate OTP21 to OTP24.</div><div><br></div><div>Roger,</div><div>We are not using NIFs. We using heavy concurrent processing to reduce response time. how to check the default allocator? </div><div><br clear="all"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><p class="MsoNormal" style="background-image:initial;background-position:initial;background-repeat:initial"><b>Regards,</b><br></p><p class="MsoNormal" style="background-image:initial;background-position:initial;background-repeat:initial"><b><span style="font-size:12pt;font-family:"Times New Roman",serif">Hitesh Vaghani</span></b><span style="font-size:12pt;font-family:"Times New Roman",serif"> </span></p></div></div></div></div></div></div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Sep 23, 2021 at 1:06 PM Roger Lipscombe <<a href="mailto:roger@differentpla.net">roger@differentpla.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Yes, recon has useful functions for reporting on fragmentation.<br>
<br>
Question: are you doing anything with NIFs? We had a problem a few<br>
years ago where the default glibc allocator in Ubuntu 14/16, when used<br>
in a heavily multi-threaded way (i.e. when being called from Erlang),<br>
caused a *lot* of fragmentation, and it's hard to track down.<br>
Switching to a more modern allocator (we chose jemalloc) basically<br>
resolved the problem immediately.<br>
<br>
On Thu, 23 Sept 2021 at 08:13, Dominic Letz <<a href="mailto:dominic@diode.io" target="_blank">dominic@diode.io</a>> wrote:<br>
><br>
> The erlang vm has it's own memory allocators (carriers) they usually create a small memory overhead. I've seen them consuming exorbitant amounts of memory before, likely because of memory fragmentation. Their usage is not reported in the erlang virtual memory stats by default but you can check them explicitly.<br>
><br>
> When fighting with memory fragmentation I created this script to show the current carrier overhead: (waste) <a href="https://gist.github.com/dominicletz/615e4b89b9e6f2059b2520ed9adac5dc" rel="noreferrer" target="_blank">https://gist.github.com/dominicletz/615e4b89b9e6f2059b2520ed9adac5dc</a><br>
><br>
> My solution in the end was to upgrade OTP to a newer version. And it made the crazy overheads go away.<br>
><br>
>  Cheers!<br>
><br>
> Max Lapshin <<a href="mailto:max.lapshin@gmail.com" target="_blank">max.lapshin@gmail.com</a>> schrieb am Do., 23. Sep. 2021, 08:42:<br>
>><br>
>> You show a strange graphic without any numbers. all other commands are also cutted.<br>
>><br>
>> Also part of your email is rather unclear: you write to a public list that your email is confidential. Bad idea.<br>
>><br>
>> About memory:<br>
>><br>
>> 1) use recon in your production. recon_alloc will help to collect big amount of information from erlang runtime<br>
>> 2) take a look at /proc/3975367/maps, sometimes it helps to find leaks or better interpret numbers.<br>
>><br>
>> What you see is a mismatch between different ways to calculate memory. Usually it is ok to live with such a difference.<br>
>><br>
>><br>
</blockquote></div>

<br>
<font size="3"><b style="color:rgb(0,0,0);font-family:'Times New Roman';font-style:normal;font-variant:normal;letter-spacing:normal;line-height:normal;text-align:-webkit-auto;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;font-size:medium;font-weight:normal"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap">::DISCLAIMER::</span><br><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap">------------------------------<wbr>------------------------------<wbr>------------------------------<wbr>------------------------------<wbr>----------------------------</span><br><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap"></span><br><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap">The contents of this e-mail and any attachments are confidential and intended for the named recipient(s) only.E-mail transmission is not guaranteed to be secure or error-free as information could be intercepted, corrupted,lost, destroyed, arrive late or incomplete, or may contain viruses in transmission. The e mail and its contents(with or without referred errors) shall therefore not</span><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap"> attach any liability on the originator or redBus.com. Views or opinions, if any, presented in this email are solely those of the author and may not necessarily reflect the views or opinions of redBus.com. Any form of reproduction, dissemination, copying, disclosure, modification,distribution and / or publication of this message without the prior written consent of authorized representative of</span><span style="font-size:15px;font-family:Arial;color:rgb(17,85,204);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:underline;vertical-align:baseline;white-space:pre-wrap"><a href="http://redbus.in/" target="_blank"> redbus.</a>com</span><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline;white-space:pre-wrap"> is strictly prohibited. If you have received this email in error please delete it and notify the sender immediately.Before opening any email and/or attachments, please check them for viruses and other defects.</span></b></font>