Changeset View
Changeset View
Standalone View
Standalone View
src/coins.h
Show First 20 Lines • Show All 310 Lines • ▼ Show 20 Lines | public: | ||||
//! Calculate the size of the cache (in bytes) | //! Calculate the size of the cache (in bytes) | ||||
size_t DynamicMemoryUsage() const; | size_t DynamicMemoryUsage() const; | ||||
//! Check whether all prevouts of the transaction are present in the UTXO | //! Check whether all prevouts of the transaction are present in the UTXO | ||||
//! set represented by this view | //! set represented by this view | ||||
bool HaveInputs(const CTransaction &tx) const; | 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: | private: | ||||
/** | /** | ||||
* @note this is marked const, but may actually append to `cacheCoins`, | * @note this is marked const, but may actually append to `cacheCoins`, | ||||
* increasing memory usage. | * increasing memory usage. | ||||
*/ | */ | ||||
CCoinsMap::iterator FetchCoin(const COutPoint &outpoint) const; | CCoinsMap::iterator FetchCoin(const COutPoint &outpoint) const; | ||||
}; | }; | ||||
▲ Show 20 Lines • Show All 42 Lines • Show Last 20 Lines |