| 579 | namespace { |
| 580 | |
| 581 | bool available_memory_bytes(uint64_t& bytes, uint64_t* commit = nullptr, std::string* why = nullptr) { |
| 582 | detail::HostMemory m; |
| 583 | if (!detail::host_available_memory(m)) { |
| 584 | if (why != nullptr && m.why != nullptr) *why = std::string(" (") + m.why + ")"; // what could not be read, for the log line |
| 585 | return false; |
| 586 | } |
| 587 | bytes = m.available; |
| 588 | if (commit != nullptr) *commit = m.commit; |
| 589 | return bytes > 0; |
| 590 | } |
| 591 | |
| 592 | /// #1250: the pages that are really free (MemFree), not the reclaimable cache MemAvailable counts; false when unknown. |
| 593 | bool free_memory_bytes(uint64_t& bytes) { |
no test coverage detected