diff options
author | Matthias Radestock <matthias@rabbitmq.com> | 2012-08-06 11:56:43 +0100 |
---|---|---|
committer | Matthias Radestock <matthias@rabbitmq.com> | 2012-08-06 11:56:43 +0100 |
commit | b2827037303a2d819d91a896c8aac733d808f582 (patch) | |
tree | 7dab8cd733f7059dfc437718192860a79b02af3a | |
parent | 31cefc007ba67b4bd5ce4ce9f87aa3d7eecd546d (diff) | |
download | rabbitmq-server-b2827037303a2d819d91a896c8aac733d808f582.tar.gz |
warn on memory clipping
-rw-r--r-- | src/vm_memory_monitor.erl | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/vm_memory_monitor.erl b/src/vm_memory_monitor.erl index 7cba36f8..85dbf368 100644 --- a/src/vm_memory_monitor.erl +++ b/src/vm_memory_monitor.erl @@ -172,7 +172,17 @@ set_mem_limits(State, MemFraction) -> ?MEMORY_SIZE_FOR_UNKNOWN_OS; M -> M end, - MemLim = trunc(MemFraction * lists:min([TotalMemory, get_vm_limit()])), + UsableMemory = case get_vm_limit() of + Limit when Limit < TotalMemory -> + error_logger:warning_msg( + "Only ~pMB of ~pMB memory usable due to " + "limited address space.~n", + [trunc(V/?ONE_MB) || V <- [Limit, TotalMemory]]), + Limit; + _ -> + TotalMemory + end, + MemLim = trunc(MemFraction * UsableMemory), error_logger:info_msg("Memory limit set to ~pMB of ~pMB total.~n", [trunc(MemLim/?ONE_MB), trunc(TotalMemory/?ONE_MB)]), internal_update(State #state { total_memory = TotalMemory, |