43
43
44
44
-define (SERVER , ? MODULE ).
45
45
-define (DEFAULT_MEMORY_CHECK_INTERVAL , 1000 ).
46
- -define (ONE_MB , 1048576 ).
46
+ -define (ONE_MiB , 1048576 ).
47
47
48
48
% % For an unknown OS, we assume that we have 1GB of memory. It'll be
49
49
% % wrong. Scale by vm_memory_high_watermark in configuration to get a
@@ -214,9 +214,10 @@ set_mem_limits(State, MemLimit) ->
214
214
memory_limit = undefined } ->
215
215
error_logger :warning_msg (
216
216
" 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 " ,
218
218
[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 ]);
220
221
_ ->
221
222
ok
222
223
end ,
@@ -227,18 +228,20 @@ set_mem_limits(State, MemLimit) ->
227
228
case get_vm_limit () of
228
229
Limit when Limit < TotalMemory ->
229
230
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 "
231
232
" limited address space.~n "
232
233
" Crashes due to memory exhaustion are possible - see~n "
233
234
" 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 ]),
235
237
Limit ;
236
238
_ ->
237
239
TotalMemory
238
240
end ,
239
241
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 ]),
242
245
internal_update (State # state { total_memory = TotalMemory ,
243
246
memory_limit = MemLim ,
244
247
memory_config_limit = MemLimit }).
@@ -402,9 +405,9 @@ parse_line_sunos(Line) ->
402
405
[Value1 | UnitsRest ] = string :tokens (RHS , " " ),
403
406
Value2 = case UnitsRest of
404
407
[" Gigabytes" ] ->
405
- list_to_integer (Value1 ) * ? ONE_MB * 1024 ;
408
+ list_to_integer (Value1 ) * ? ONE_MiB * 1024 ;
406
409
[" Megabytes" ] ->
407
- list_to_integer (Value1 ) * ? ONE_MB ;
410
+ list_to_integer (Value1 ) * ? ONE_MiB ;
408
411
[" Kilobytes" ] ->
409
412
list_to_integer (Value1 ) * 1024 ;
410
413
_ ->
0 commit comments