mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-09 06:09:48 +02:00
Add CChainState::ResizeCoinsCaches
Also adds CCoinsViewCache::ReallocateCache() to attempt to free
memory that the cacheCoins's allocator may be hanging onto when
downsizing the cache.
Adds `CChainState::m_coins{tip,db}_cache_size_bytes` data members
so that we can reference cache size on a per-chainstate basis for
flushing.
This commit is contained in:
committed by
James O'Beirne
parent
b223111da2
commit
f36aaa6392
@@ -318,6 +318,13 @@ public:
|
||||
//! Check whether all prevouts of the transaction are present in the UTXO set represented by this view
|
||||
bool HaveInputs(const CTransaction& tx) const;
|
||||
|
||||
//! Force a reallocation of the cache map. This is required when downsizing
|
||||
//! the cache because the map's allocator may be hanging onto a lot of
|
||||
//! memory despite having called .clear().
|
||||
//!
|
||||
//! See: https://stackoverflow.com/questions/42114044/how-to-release-unordered-map-memory
|
||||
void ReallocateCache();
|
||||
|
||||
private:
|
||||
/**
|
||||
* @note this is marked const, but may actually append to `cacheCoins`, increasing
|
||||
|
||||
Reference in New Issue
Block a user