[erlang-questions] Relationship between erlang:memory/1, ets:info/2 and erlang:process_info/2
Fri Sep 21 18:50:53 CEST 2012
I'm trying to write something that will account for memory use on a
RabbitMQ system. To do this I'm trying to match up the numbers I get out
of erlang:memory(ets) and ets:info(T, memory), and
erlang:memory(processes) and erlang:process_info/2.
And it doesn't make a huge amount of sense to me. I don't expect things
to match up perfectly, of course there will be some memory unaccounted
for, but the ETS numbers in particular can be quite off:
2> lists:sum([ets:info(T, memory) || T <- ets:all()]) *
So I have ~2GB of ETS memory, and ~230MB unaccounted for. Should I
expect these to match up closer?
4> lists:sum([element(2, process_info(P, memory)) || P <- processes()]).
So for processes there is less in total than if you add them all up. Is
some memory shared? (Are we counting binaries and atoms in there as well?)
Is there a way to get this sort of information in a more consistent manner?
More information about the erlang-questions