instance_size(Items, Init) ->
lists:foldl(fun
({_, [{blocks_size,BS,_,_}, {carriers_size,CS,_,_}]}, {Used, Total}) ->
{Used+BS, Total+CS};
({_,[{blocks_size,BS},{carriers_size,CS}]}, {Used, Total}) ->
{Used+BS, Total+CS};
(_, Acc) -> Acc
end, Init, Items).
allocator_size(Instances, Init) ->
lists:foldl(
fun({instance, _No, Items}, Acc) ->
instance_size(Items, Acc)
end,
Init,
Instances).
total_size() ->
AllocNames = erlang:system_info(alloc_util_allocators),
AllAllocators = erlang:system_info({allocator_sizes, AllocNames}),
lists:foldl(
fun({_, Instances}, Acc) -> allocator_size(Instances, Acc) end,
{0, 0},
AllAllocators).
--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-users+unsubscribe@googlegroups.com.
To post to this group, send email to rabbitmq-users@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
GetVmMemory = fun() ->
AllocNames = erlang:system_info(alloc_util_allocators),
AllocMems = erlang:system_info({allocator_sizes, AllocNames}),
AllItems = [ Item ||
{_, Instances} <- AllocMems,
{instance, _, Items} <- Instances,
Item <- Items
],
lists:foldl(fun
({_, [{blocks_size,BS,_,_}, {carriers_size,CS,_,_}]}, {Used, Total}) ->
{Used+BS, Total+CS};
({_, [{blocks_size,BS}, {carriers_size,CS}]}, {Used, Total}) ->
{Used+BS, Total+CS};
(_, Acc) -> Acc
end, {0, 0}, AllItems)
% {UsedBytes, AllocatedBytes}
end.To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
that's an interesting idea to investigate, thanks
--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-users+unsubscribe@googlegroups.com.
To post to this group, send email to rabbitmq-users@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-users+unsubscribe@googlegroups.com.
To post to this group, send email to rabbitmq-users@googlegroups.com.
Now my question is - are there any guarantees that pre-allocated memory will be eventually released back to OS eventually? How much time does it take?
Just to explain why I am asking that. If memory_used goes above memory_limit, RabbitMQ stops accepting new messages until memory_used drops.
But what causes it to drop?
First scenario is when majority of memory is taken by queues - lots of messages get queued taking the memory, RabbitMQ memory_used grows above threshold and RabbitMQ blocks producers. Now as consumers can go through queues and release queue memory back to Erlang. But is it enough? It won't be reflected in RSS until Erlang returns that memory to the OS. When is it going to happen?