Page MenuHomePhorge

No OneTemporary

Size
879 B
Referenced Files
None
Subscribers
None
diff --git a/test/exile/sync_process_test.exs b/test/exile/sync_process_test.exs
new file mode 100644
index 0000000..784f4a6
--- /dev/null
+++ b/test/exile/sync_process_test.exs
@@ -0,0 +1,26 @@
+defmodule Exile.SyncProcessTest do
+ use ExUnit.Case, async: false
+ alias Exile.Process
+
+ @bin Stream.repeatedly(fn -> "A" end) |> Enum.take(65535) |> IO.iodata_to_binary()
+
+ test "memory leak" do
+ :timer.sleep(1000)
+ before_exec = :erlang.memory(:total)
+
+ {:ok, s} = Process.start_link("cat", [])
+
+ Enum.each(1..500, fn _ ->
+ :ok = Process.write(s, @bin)
+ {:ok, _} = Process.read(s, 65535)
+ end)
+
+ :timer.sleep(1000)
+ after_exec = :erlang.memory(:total)
+
+ assert_in_delta before_exec, after_exec, 1024 * 1024
+
+ assert :ok == Process.close_stdin(s)
+ assert {:ok, {:exit, 0}} == Process.await_exit(s, 500)
+ end
+end

File Metadata

Mime Type
text/x-diff
Expires
Fri, Nov 29, 11:52 PM (1 d, 20 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41330
Default Alt Text
(879 B)

Event Timeline