Changeset View
Changeset View
Standalone View
Standalone View
src/validation.cpp
Show First 20 Lines • Show All 2,075 Lines • ▼ Show 20 Lines | try { | ||||
if (nLastFlush == 0) { | if (nLastFlush == 0) { | ||||
nLastFlush = nNow; | nLastFlush = nNow; | ||||
} | } | ||||
if (nLastSetChain == 0) { | if (nLastSetChain == 0) { | ||||
nLastSetChain = nNow; | nLastSetChain = nNow; | ||||
} | } | ||||
int64_t nMempoolSizeMax = | int64_t nMempoolSizeMax = | ||||
gArgs.GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000; | gArgs.GetArg("-maxmempool", DEFAULT_MAX_MEMPOOL_SIZE) * 1000000; | ||||
int64_t cacheSize = pcoinsTip->DynamicMemoryUsage(); | // Compensate for extra memory peak (x1.5-x1.9) at flush time. | ||||
int64_t cacheSize = pcoinsTip->DynamicMemoryUsage() * 2; | |||||
int64_t nTotalSpace = | int64_t nTotalSpace = | ||||
nCoinCacheUsage + | nCoinCacheUsage + | ||||
std::max<int64_t>(nMempoolSizeMax - nMempoolUsage, 0); | std::max<int64_t>(nMempoolSizeMax - nMempoolUsage, 0); | ||||
// The cache is large and we're within 10% and 10 MiB of the limit, | // The cache is large and we're within 10% and 10 MiB of the limit, | ||||
// but we have time now (not in the middle of a block processing). | // but we have time now (not in the middle of a block processing). | ||||
bool fCacheLarge = | bool fCacheLarge = | ||||
mode == FlushStateMode::PERIODIC && | mode == FlushStateMode::PERIODIC && | ||||
cacheSize > std::max((9 * nTotalSpace) / 10, | cacheSize > std::max((9 * nTotalSpace) / 10, | ||||
▲ Show 20 Lines • Show All 3,642 Lines • Show Last 20 Lines |