<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jan 23, 2015 at 1:26 PM, Roberto Ostinelli <span dir="ltr"><<a href="mailto:roberto@widetag.com" target="_blank">roberto@widetag.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>I do not have such system yet in place, as this isn't a production environment (yet).</div><div><br></div><div>Will definitely add one asap.</div></blockquote></div><br>In my experience, instrumentation of the running production/development system is one of the most important things to add early on. The views of the system it gives and the depth at which it explains what is going on will help in so many debugging scenarios you can't fathom it.</div><div class="gmail_extra"><br></div><div class="gmail_extra">My hunch is you are holding on to binary values for too long in some processes, or are storing a ref-c binary in ETS which keeps the underlying binary alive. The two major ways to handle this has already been mentioned.</div><div class="gmail_extra"><br></div><div class="gmail_extra">If you are picking apart a large binary, and you need to reference *binary* data in it, then it may be beneficial to break that binary data off:</div><div class="gmail_extra"><br></div><div class="gmail_extra"><<Payload:Len/binary, "\r\n", Rest/binary>> = Packet,</div><div class="gmail_extra">CPayload = binary:copy(Payload),</div><div class="gmail_extra">...</div><div class="gmail_extra">recurse_on(Rest).</div><div class="gmail_extra"><br></div><div class="gmail_extra">but as Dan says, copying `Rest` in this case is a bad idea. You just copy the very binary you are running over and processing. Also note that it is important you are picking out binary data. If you had something like</div><div class="gmail_extra"><br></div><div class="gmail_extra"><<I:32/integer, "\r\n", Rest/binary>></div><div class="gmail_extra"><br></div><div class="gmail_extra">then the integer conversion already excises the data from the binary, so you don't have to keep the binary around anymore.</div><div class="gmail_extra"><br clear="all"><div><br></div>-- <br><div class="gmail_signature">J.</div>
</div></div>