Excessive memory usage with inspect/2
fertapric opened this issue · 0 comments
fertapric commented
Elixir and Erlang/OTP versions
Erlang/OTP 27 [erts-15.1.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1]
Elixir 1.17.3 (compiled with Erlang/OTP 27)
Operating system
macOS Big sur 11.7.10
Current behavior
There is a roughly ~500MB difference in memory usage (measured using /usr/bin/time -l elixir memory_bam_bam.exs
) between these two snippets:
data = Base.encode64(:crypto.strong_rand_bytes(2_000_000))
and
data = Base.encode64(:crypto.strong_rand_bytes(2_000_000))
IO.inspect data, printable_limit: :infinity
which seems a bit high taking into account we are inspecting a ~2-3MB binary.
Here is a repo with the code that reproduces the problem (and some Docker examples as well in which the container is OOM Killed).
Expected behavior
Less memory usage.