<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, May 28, 2014 at 10:26 AM, Lukas Larsson <span dir="ltr"><<a href="mailto:lukas@erlang-solutions.com" target="_blank">lukas@erlang-solutions.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Binaries can also be present in ets objects and messages in processes' message queues. I'm sure there are some other places as well, but those should be the major ones.</blockquote>

</div><br>This is a common case. Say you have a binary of size 1024 bytes and you pick out an identifier in it which is 8 bytes. The identifier is now a sub-binary which keeps the large binary around. If you stick the identifier somewhere, you will be "wasting" 1024-8 bytes.</div>

<div class="gmail_extra"><br></div><div class="gmail_extra">The solution is to explicitly put a binary:copy/1 in place to "lift out" the small identifier.<br><br clear="all"><div><br></div>-- <br>J.
</div></div>