mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-12 05:34:57 +01:00
Implement accurate memory accounting for mempool
This commit is contained in:
@@ -260,3 +260,8 @@ std::string CScript::ToString() const
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
size_t CScript::DynamicMemoryUsage() const
|
||||
{
|
||||
return memusage::DynamicUsage(*(static_cast<const std::vector<unsigned char>*>(this)));
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#ifndef BITCOIN_SCRIPT_SCRIPT_H
|
||||
#define BITCOIN_SCRIPT_SCRIPT_H
|
||||
|
||||
#include "memusage.h"
|
||||
#include "crypto/common.h"
|
||||
|
||||
#include <assert.h>
|
||||
@@ -607,6 +608,8 @@ public:
|
||||
// The default std::vector::clear() does not release memory.
|
||||
std::vector<unsigned char>().swap(*this);
|
||||
}
|
||||
|
||||
size_t DynamicMemoryUsage() const;
|
||||
};
|
||||
|
||||
class CReserveScript
|
||||
|
||||
Reference in New Issue
Block a user