diff options
author | James O'Beirne <james.obeirne@gmail.com> | 2019-09-16 15:01:12 -0400 |
---|---|---|
committer | James O'Beirne <james.obeirne@pm.me> | 2020-07-01 14:44:28 -0400 |
commit | f36aaa6392fdbdac6891d92202d3efeff98754f4 (patch) | |
tree | 4cebab3fa566f6f9dc53228b92264f1cda6095b1 /src/coins.h | |
parent | b223111da2e0e9ceccef75df8a20252b0094b7bc (diff) |
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.
Diffstat (limited to 'src/coins.h')
-rw-r--r-- | src/coins.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/coins.h b/src/coins.h index a3f34bb0ee..a3e241ac90 100644 --- a/src/coins.h +++ b/src/coins.h @@ -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 |