diff --git a/src/Summary.cpp b/src/Summary.cpp index 4d295e445..6ad6819dc 100644 --- a/src/Summary.cpp +++ b/src/Summary.cpp @@ -104,9 +104,12 @@ static void print_cpu(Config *) static void print_threads(Config *config) { - Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s") CYAN_BOLD("%.1f GB"), + constexpr size_t oneGiB = 1024U * 1024U * 1024U; + + Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s") CYAN_BOLD("%.1f/%.1f GB"), "MEMORY", - static_cast(uv_get_total_memory()) / (1024U * 1024U * 1024U) + static_cast(uv_get_free_memory()) / oneGiB, + static_cast(uv_get_total_memory()) / oneGiB ); Log::print(GREEN_BOLD(" * ") WHITE_BOLD("%-13s") WHITE_BOLD("%s%d%%"), diff --git a/src/base/api/Api.cpp b/src/base/api/Api.cpp index 9bed34df9..c66241c9c 100644 --- a/src/base/api/Api.cpp +++ b/src/base/api/Api.cpp @@ -67,6 +67,7 @@ static rapidjson::Value getResources(rapidjson::Document &doc) Value memory(kObjectType); Value load_average(kArrayType); + memory.AddMember("free", uv_get_free_memory(), allocator); memory.AddMember("total", uv_get_total_memory(), allocator); memory.AddMember("resident_set_memory", static_cast(rss), allocator); diff --git a/src/crypto/rx/RxDataset.cpp b/src/crypto/rx/RxDataset.cpp index ce41a58ea..fb2ef9d18 100644 --- a/src/crypto/rx/RxDataset.cpp +++ b/src/crypto/rx/RxDataset.cpp @@ -167,7 +167,7 @@ void xmrig::RxDataset::allocate(bool hugePages) return; } - if (m_mode == RxConfig::AutoMode && uv_get_total_memory() < (maxSize() + RxCache::maxSize())) { + if (m_mode == RxConfig::AutoMode && uv_get_free_memory() < (maxSize() + RxCache::maxSize())) { LOG_ERR(CLEAR "%s" RED_BOLD_S "not enough memory for RandomX dataset", rx_tag()); return;