4343
4444-define (SERVER , ? MODULE ).
4545-define (DEFAULT_MEMORY_CHECK_INTERVAL , 1000 ).
46- -define (ONE_MB , 1048576 ).
46+ -define (ONE_MiB , 1048576 ).
4747
4848% % For an unknown OS, we assume that we have 1GB of memory. It'll be
4949% % wrong. Scale by vm_memory_high_watermark in configuration to get a
@@ -214,9 +214,10 @@ set_mem_limits(State, MemLimit) ->
214214 memory_limit = undefined } ->
215215 error_logger :warning_msg (
216216 " Unknown total memory size for your OS ~p . "
217- " Assuming memory size is ~p MB .~n " ,
217+ " Assuming memory size is ~p MiB ( ~p bytes) .~n " ,
218218 [os :type (),
219- trunc (? MEMORY_SIZE_FOR_UNKNOWN_OS / ? ONE_MB )]);
219+ trunc (? MEMORY_SIZE_FOR_UNKNOWN_OS / ? ONE_MiB ),
220+ ? MEMORY_SIZE_FOR_UNKNOWN_OS ]);
220221 _ ->
221222 ok
222223 end ,
@@ -227,18 +228,20 @@ set_mem_limits(State, MemLimit) ->
227228 case get_vm_limit () of
228229 Limit when Limit < TotalMemory ->
229230 error_logger :warning_msg (
230- " Only ~p MB of ~p MB memory usable due to "
231+ " Only ~p MiB ( ~p bytes) of ~p MiB ( ~p bytes) memory usable due to "
231232 " limited address space.~n "
232233 " Crashes due to memory exhaustion are possible - see~n "
233234 " http://www.rabbitmq.com/memory.html#address-space~n " ,
234- [trunc (V / ? ONE_MB ) || V <- [Limit , TotalMemory ]]),
235+ [trunc (Limit / ? ONE_MiB ), Limit , trunc (TotalMemory / ? ONE_MiB ),
236+ TotalMemory ]),
235237 Limit ;
236238 _ ->
237239 TotalMemory
238240 end ,
239241 MemLim = interpret_limit (parse_mem_limit (MemLimit ), UsableMemory ),
240- error_logger :info_msg (" Memory limit set to ~p MB of ~p MB total.~n " ,
241- [trunc (MemLim / ? ONE_MB ), trunc (TotalMemory / ? ONE_MB )]),
242+ error_logger :info_msg (" Memory limit set to ~p MiB (~p bytes) of ~p MiB (~p bytes) total.~n " ,
243+ [trunc (MemLim / ? ONE_MiB ), MemLim , trunc (TotalMemory / ? ONE_MiB ),
244+ TotalMemory ]),
242245 internal_update (State # state { total_memory = TotalMemory ,
243246 memory_limit = MemLim ,
244247 memory_config_limit = MemLimit }).
@@ -402,9 +405,9 @@ parse_line_sunos(Line) ->
402405 [Value1 | UnitsRest ] = string :tokens (RHS , " " ),
403406 Value2 = case UnitsRest of
404407 [" Gigabytes" ] ->
405- list_to_integer (Value1 ) * ? ONE_MB * 1024 ;
408+ list_to_integer (Value1 ) * ? ONE_MiB * 1024 ;
406409 [" Megabytes" ] ->
407- list_to_integer (Value1 ) * ? ONE_MB ;
410+ list_to_integer (Value1 ) * ? ONE_MiB ;
408411 [" Kilobytes" ] ->
409412 list_to_integer (Value1 ) * 1024 ;
410413 _ ->
0 commit comments