Skip to content

Instantly share code, notes, and snippets.

@qhwa
Created May 10, 2020 03:55
Show Gist options
  • Select an option

  • Save qhwa/a83ee9e6ab91e3be66fe929f25f74933 to your computer and use it in GitHub Desktop.

Select an option

Save qhwa/a83ee9e6ab91e3be66fe929f25f74933 to your computer and use it in GitHub Desktop.
A demo of binary referencing in Elixir
iex> a_very_large_binary = :binary.copy("x", 1000)
...> <<_first_three_bytes::binary-3, rest::binary>> = a_very_large_binary
...> byte_size(rest)
997
...> :binary.referenced_byte_size(rest)
1000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment