<div dir="ltr">Hi Jesper, thank you for your input.<div class="gmail_extra"><br></div><div class="gmail_extra"><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><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.<br></div></div></blockquote><div><br></div><div>I'm not storing binaries in a ETS. Also, I don't see anywhere I'm holding binary values for too long.</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"></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:<br></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></blockquote><div><br></div><div>Ok, as per this suggestion I removed copying the Rest.</div><div><br></div><div>Thanks,</div><div>r. <br></div></div><br></div></div>