mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Add 'dropCache' function to remove extraneous nodes from memory.
This commit is contained in:
@@ -153,6 +153,13 @@ public:
|
||||
// low level functions
|
||||
SHAMap::ref peekTransactionMap() { return mTransactionMap; }
|
||||
SHAMap::ref peekAccountStateMap() { return mAccountStateMap; }
|
||||
void dropCache()
|
||||
{
|
||||
if (mTransactionMap)
|
||||
mTransactionMap->dropCache();
|
||||
if (mAccountStateMap)
|
||||
mAccountStateMap->dropCache();
|
||||
}
|
||||
|
||||
// ledger sync functions
|
||||
void setAcquiring(void);
|
||||
|
||||
@@ -851,6 +851,15 @@ bool SHAMap::getPath(const uint256& index, std::vector< std::vector<unsigned cha
|
||||
return true;
|
||||
}
|
||||
|
||||
void SHAMap::dropCache()
|
||||
{ // CAUTION: Changes can be lost
|
||||
boost::recursive_mutex::scoped_lock sl(mLock);
|
||||
|
||||
mTNByID.clear();
|
||||
if (root)
|
||||
mTNByID[*root] = root;
|
||||
}
|
||||
|
||||
void SHAMap::dump(bool hash)
|
||||
{
|
||||
#if 0
|
||||
|
||||
@@ -382,6 +382,9 @@ public:
|
||||
// Returns a new map that's a snapshot of this one. Force CoW
|
||||
SHAMap::pointer snapShot(bool isMutable);
|
||||
|
||||
// Remove nodes from memory
|
||||
void dropCache();
|
||||
|
||||
// hold the map stable across operations
|
||||
ScopedLock Lock() const { return ScopedLock(mLock); }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user