mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-09-12 21:52:53 +02:00
scripted-diff: use TryGetTotalRam
Use the `Try` prefix to make failed RAM detection visible at call sites. -BEGIN VERIFY SCRIPT- git grep -q 'TryGetTotalRam' -- src && echo "Error: TryGetTotalRam already exists in src" && exit 1 git grep -l 'GetTotalRAM' -- src | xargs perl -pi -e 's/\bGetTotalRAM\b/TryGetTotalRam/g' -END VERIFY SCRIPT-
This commit is contained in:
@@ -40,7 +40,7 @@ namespace node {
|
||||
uint64_t GetDefaultDBCache()
|
||||
{
|
||||
if constexpr (sizeof(void*) >= 8) {
|
||||
if (GetTotalRAM().value_or(0) >= HIGH_DEFAULT_DBCACHE_MIN_TOTAL_RAM) {
|
||||
if (TryGetTotalRam().value_or(0) >= HIGH_DEFAULT_DBCACHE_MIN_TOTAL_RAM) {
|
||||
return HIGH_DEFAULT_DBCACHE;
|
||||
}
|
||||
}
|
||||
@@ -88,7 +88,7 @@ CacheSizes CalculateCacheSizes(const ArgsManager& args, size_t n_indexes)
|
||||
|
||||
void LogOversizedDbCache(const ArgsManager& args) noexcept
|
||||
{
|
||||
if (const auto total_ram{GetTotalRAM()}) {
|
||||
if (const auto total_ram{TryGetTotalRam()}) {
|
||||
const uint64_t db_cache{CalculateDbCacheBytes(args)};
|
||||
if (ShouldWarnOversizedDbCache(db_cache, *total_ram)) {
|
||||
InitWarning(bilingual_str{tfm::format(_("A %zu MiB dbcache may be too large for a system memory of only %zu MiB."),
|
||||
|
||||
Reference in New Issue
Block a user