Skip to content

Instantly share code, notes, and snippets.

@davisp
Created February 11, 2017 20:52
Show Gist options
  • Save davisp/58307748f55e6b170140a390913b03aa to your computer and use it in GitHub Desktop.
Save davisp/58307748f55e6b170140a390913b03aa to your computer and use it in GitHub Desktop.
(fun() ->
SizePids = lists:flatmap(fun(Pid) ->
Size = case process_info(Pid, binary) of
{binary, BinInfos} ->
lists:sum([S || {_, S, _} <- BinInfos]);
undefined ->
0
end,
if Size == 0 -> []; true ->
[{Size, Pid}]
end
end, processes()),
lists:reverse(lists:sort(SizePids))
end)().
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment