Created
March 29, 2017 16:38
-
-
Save rozap/a1e170f1058d7e528d0b95b3570c8dee to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def print_mem(label) do | |
case :erlang.process_info(self, :binary) do | |
{:binary, bins} -> | |
{size, count} = Enum.reduce(bins, {0, 0}, fn {_bid, size, count}, {s, c} -> {size + s, count + c} end) | |
Logger.warn("#{label} usage in #{__MODULE__} is #{size / 1000000}mb, #{count} of them") | |
_ -> :ok | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment