Created
July 18, 2013 12:32
-
-
Save ferd/6028931 to your computer and use it in GitHub Desktop.
Find Erlang processes that may be leaking refc binaries
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
f(MostLeaky). | |
MostLeaky = fun(N) -> | |
lists:sublist( | |
lists:usort( | |
fun({K1,V1},{K2,V2}) -> {V1,K1} =< {V2,K2} end, | |
[try | |
{_,Pre} = erlang:process_info(Pid, binary), | |
erlang:garbage_collect(Pid), | |
{_,Post} = erlang:process_info(Pid, binary), | |
{Pid, length(Post)-length(Pre)} | |
catch | |
_:_ -> {Pid, 0} | |
end || Pid <- processes()]), | |
N) | |
end. | |
%% Pairs = MostLeaky(25). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment