Search code examples
referenceerlangbinary-datatrace

Finding erlang binary references


Erlang reference counts large binaries and created sub binaries which prevent the referenced binary from being deallocated during garbage collection.

I can see the allocated binary amount in the observer or in erlang:memory()

The problem is that tracking down where the larger binary is coming from is proving challenging. Is there any specific technique or tool that can be used to find the referenced data for inspection, or the function that originally created the reference via tracing?


Solution

  • The erlang:process_info/2 call with a second argument of binary might help, but in general you should have a look at the Recon library, as I believe it can help you with this. Its author, Fred Hébert, posted a highly useful article about using it in his blog.