Skip to content

Commit

Permalink
Reduce maximum coinscache size during verification
Browse files Browse the repository at this point in the history
Due to growing coinsviewcaches, the memory usage with checklevel=3
(and standard settings for dbcache) could be up to 500MiB on a
64-bit system. This is about twice the peak during reindexing,
unnecessarily extending bitcoind's memory envelope.

This commit reduces the maximum total size of the caches used during
verification to just nCoinCacheSize, which should be the limit.
  • Loading branch information
laanwj committed Aug 11, 2014
1 parent f5d9907 commit ea100c7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3052,7 +3052,7 @@ bool CVerifyDB::VerifyDB(int nCheckLevel, int nCheckDepth)
}
}
// check level 3: check for inconsistencies during memory-only disconnect of tip blocks
if (nCheckLevel >= 3 && pindex == pindexState && (coins.GetCacheSize() + pcoinsTip->GetCacheSize()) <= 2*nCoinCacheSize + 32000) {
if (nCheckLevel >= 3 && pindex == pindexState && (coins.GetCacheSize() + pcoinsTip->GetCacheSize()) <= nCoinCacheSize) {
bool fClean = true;
if (!DisconnectBlock(block, state, pindex, coins, &fClean))
return error("VerifyDB() : *** irrecoverable inconsistency in block data at %d, hash=%s", pindex->nHeight, pindex->GetBlockHash().ToString());
Expand Down

0 comments on commit ea100c7

Please sign in to comment.