Skip to content

Instantly share code, notes, and snippets.

@vorce
Last active September 27, 2021 08:54
Show Gist options
  • Save vorce/08f5acb29d35da1ff465c1c0c11170e2 to your computer and use it in GitHub Desktop.
Save vorce/08f5acb29d35da1ff465c1c0c11170e2 to your computer and use it in GitHub Desktop.
Show what's using memory
# show top memory using processes
:erlang.processes()
|> Enum.map(fn pid ->
:erlang.process_info(pid, [:memory, :current_function, :current_location])
end)
|> Enum.sort_by(fn process_info -> process_info[:memory] end)
|> Enum.reverse()
|> Enum.take(25)
# show top memory using ETS tables
:ets.all()
|> Enum.map(fn table ->
[memory: :ets.info(table, :memory), size: :ets.info(table, :size), name: :ets.info(table, :name)]
end)
|> Enum.sort()
|> Enum.reverse()
|> Enum.take(25)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment