Skip to content

Stream.zip/1 with empty list induces memory spike #12459

@alecostard

Description

@alecostard

Elixir and Erlang/OTP versions

Erlang/OTP 25 [erts-13.1.5] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit:ns]

Elixir 1.14.3 (compiled with Erlang/OTP 25)

Operating system

x86_64 GNU/Linux

Current behavior

When executed, the line below consumes all memory:

 [] |> Stream.zip() |> Enum.to_list()

A less nasty way to check is to run the following while monitoring ram/cpu:

spawn(fn ->
  :timer.kill_after(3000)
  [] |> Stream.zip() |> Enum.to_list()
  IO.puts("done")
end)

Expected behavior

When "materialized", Stream.zip([]) should not cause a memory spike and just be the empty list.

[] == [] |> Stream.zip() |> Enum.to_list() 

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions