diff options
| author | Marek Majkowski <majek@lshift.net> | 2010-01-28 11:34:29 -0500 |
|---|---|---|
| committer | Marek Majkowski <majek@lshift.net> | 2010-01-28 11:34:29 -0500 |
| commit | 59db1345dde316eee80f24a472e403da83fd7f16 (patch) | |
| tree | a61146bc997e3912de86245bb33c895b0632f8fc /src | |
| parent | 340b9dab1e3fb9a03c7addba549a04472e705750 (diff) | |
| download | rabbitmq-server-git-59db1345dde316eee80f24a472e403da83fd7f16.tar.gz | |
bug22266: redefined what memory limit shall mean
Diffstat (limited to 'src')
| -rw-r--r-- | src/vm_memory_monitor.erl | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/vm_memory_monitor.erl b/src/vm_memory_monitor.erl index 91788caae8..9778401513 100644 --- a/src/vm_memory_monitor.erl +++ b/src/vm_memory_monitor.erl @@ -218,7 +218,8 @@ get_vm_limit() -> end. get_mem_limit(MemFraction, TotalMemory) -> - lists:min([trunc(TotalMemory * MemFraction), get_vm_limit()]). + AvMem = lists:min([TotalMemory, get_vm_limit()]), + trunc(AvMem * MemFraction). %%---------------------------------------------------------------------------- %% Internal Helpers @@ -254,7 +255,14 @@ get_total_memory({win32,_OSname}) -> {ok, [_MemLoad, TotPhys, _AvailPhys, _TotPage, _AvailPage, _TotV, _AvailV], _RestStr} = io_lib:fread("~d~d~d~d~d~d~d", Result), - TotPhys; + %% Due to erlang bug, on some windows boxes this number is less than zero. + %% for example Windows 7 64 bit with 4Gigs of RAM: + %% > os_mon_sysinfo:get_mem_info(). + %% ["76 -1658880 1016913920 -1 -1021628416 2147352576 2134794240\n"] + case TotPhys < 1 of + true -> unknown; + false -> TotPhys + end; get_total_memory({unix, linux}) -> File = read_proc_file("/proc/meminfo"), |
