aboutsummaryrefslogtreecommitdiff
path: root/src/init.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2016-06-27 15:39:28 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2016-07-06 07:44:51 +0200
commit32cab91278651d07a11132b7636dc3d21144e616 (patch)
tree4accba322e45e4cea27af76f8eb92655abd822a3 /src/init.cpp
parent1922e5a6545835ac57e8a56aa4c4a251c07fe9e9 (diff)
downloadbitcoin-32cab91278651d07a11132b7636dc3d21144e616.tar.xz
Bump `-dbcache` default to 300MiB
Also cap the allocation for the leveldb-specific cache for the UTXO set to 8MiB. This avoids that the extra cache memory goes to the much less effective leveldb cache instead of our application-level cache.
Diffstat (limited to 'src/init.cpp')
-rw-r--r--src/init.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/init.cpp b/src/init.cpp
index 5d29f14eb8..22a6af74e0 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -1216,10 +1216,10 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
nTotalCache = std::max(nTotalCache, nMinDbCache << 20); // total cache cannot be less than nMinDbCache
nTotalCache = std::min(nTotalCache, nMaxDbCache << 20); // total cache cannot be greated than nMaxDbcache
int64_t nBlockTreeDBCache = nTotalCache / 8;
- if (nBlockTreeDBCache > (1 << 21) && !GetBoolArg("-txindex", DEFAULT_TXINDEX))
- nBlockTreeDBCache = (1 << 21); // block tree db cache shouldn't be larger than 2 MiB
+ nBlockTreeDBCache = std::min(nBlockTreeDBCache, (GetBoolArg("-txindex", DEFAULT_TXINDEX) ? nMaxBlockDBAndTxIndexCache : nMaxBlockDBCache) << 20);
nTotalCache -= nBlockTreeDBCache;
int64_t nCoinDBCache = std::min(nTotalCache / 2, (nTotalCache / 4) + (1 << 23)); // use 25%-50% of the remainder for disk cache
+ nCoinDBCache = std::min(nCoinDBCache, nMaxCoinsDBCache << 20); // cap total coins db cache
nTotalCache -= nCoinDBCache;
nCoinCacheUsage = nTotalCache; // the rest goes to in-memory cache
LogPrintf("Cache configuration:\n");