<div dir="ltr">Hi!<div><br></div><div>Our application has allocated over 11 GB of memory and I don't understand why.</div><div><br></div><div>The application contains:</div><div> - HTTPS server using old mochiweb and OTP SSL</div>

<div> - interfaces to internal services using lhttpc</div><div> - caches using ETS</div><div><br></div><div>First problem: over 11 GB is allocated but only 5 GB are used:</div><div><div>> erlang:memory().                                         </div>

<div>[{total,5154952544},</div><div> {processes,1893901080},</div><div> {processes_used,1893832024},</div><div> {system,3261051464},</div><div> {atom,553569},</div><div> {atom_used,533811},</div><div> {binary,520767552},</div>

<div> {code,12580030},</div><div> {ets,154178408}]</div><div><br></div><div>I understand that 50% allocator usage ratio is subject to changing allocation strategy.</div><div><br></div><div>Question: Are there any tips on choosing one apart of "try and see what happens"?</div>

<div><br></div><div><br></div><div>Second problem: as you can see above, system consumes 3.2 GB when atom, binary, code, ets sum up to less than 1 GB.</div><div><br></div>Question: Where did 2.5 GB go? Earlier (R16B+) this application could run for weeks with half (13K) of current (28K) connection count and use less than 2 GB. The most significant change about memory is a small binary kept in each worker's dictionary.</div>

<div><br></div><div><br></div><div>Third problem: <br><div>MBCSs = [proplists:get_value(mbcs_usage, Info) || {{binary_alloc,_}, Info} <- recon_alloc:fragmentation(current)], lists:sum(MBCSs)/length(MBCSs).</div><div>0.13687142195007596<br>

<br>Question: is there a way to reallocate long-living binaries without changing the code so that they don't hold this much memory?</div><div>Question: How can I list binaries in single carrier? I want to see contents and referencing pids.</div>

<div>Question: Given an entry from process_info(Pid, binary) like this: {139767104723144,19,1} how can I see carrier ID and contents of this binary?</div><div><br></div><div><br></div><div>I have recon_alloc snapshot and can send it if needed.</div>

<div><br></div>-- <br><div dir="ltr"><div><font face="'courier new', monospace">Danil Zagoskin | <a href="mailto:z@gosk.in" target="_blank">z@gosk.in</a></font></div></div></div></div>