[erlang-questions] How to see which processes used ets table?
Morgan Segalis
msegalis@REDACTED
Tue Feb 5 16:06:49 CET 2013
I have crafted a little function for process monitoring purpose, it might help you, if you're memory issue is process related...
Hope it will help
[CODE]
info() ->
get_info(erlang:processes(), dict:new()).
get_info([], Dict) ->
io:fwrite("Dict: ~p~n", [Dict]);
get_info([P|L], Dict) ->
case erlang:process_info(P, dictionary) of
{dictionary, Info} ->
Initial_call = get_dict('$initial_call', Info),
Ancestor = get_dict('$ancestors', Info),
case dict:find({Initial_call, Ancestor}, Dict) of
{ok, Nb} ->
IncrNb = Nb + 1;
error ->
IncrNb = 1
end,
Dict2 = dict:store({Initial_call, Ancestor}, IncrNb, Dict),
get_info(L, Dict2);
undefined ->
case dict:find(undefined, Dict) of
{ok, Nb} ->
IncrNb = Nb + 1;
error ->
IncrNb = 1
end,
Dict2 = dict:store(undefined, IncrNb, Dict),
get_info(L, Dict2)
end.
[/CODE]
Le 5 févr. 2013 à 03:42, Solomon a écrit :
> I checked system info with erlang:memory/1 and found the total amount of memory allocated for ets tables was about 5GB.
>
> Then I sum the memory size return by ets:i/0 and it was about 600MB.
>
> So which processes used ets table and did not return by ets:i/0?
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
More information about the erlang-questions
mailing list