Created
September 11, 2019 22:11
-
-
Save redink/10130c314180a2d0effa570c25ab8266 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule T do | |
# refc binary | |
def test do | |
for _ <- 1..600, do: spawn fn -> start() end | |
end | |
defp start do | |
me = self() | |
Process.spawn(fn -> handle_big_binary(me) end, []) | |
receive do | |
{:ok, value} -> | |
:timer.sleep(1000000) | |
value | |
end | |
end | |
defp handle_big_binary(master_pid) do | |
big_binary = :binary.copy(<<1>>, 20 * 1024 * 1024) | |
<<small_binary::size(1)-binary, _::binary>> = big_binary | |
# Process.send(master_pid, {:ok, :binary.copy(small_binary)}, []) | |
Process.send(master_pid, {:ok, small_binary}, []) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment