diff options
| author | Wladimir J. van der Laan <[email protected]> | 2015-07-11 15:47:26 +0200 |
|---|---|---|
| committer | Wladimir J. van der Laan <[email protected]> | 2015-07-11 15:47:43 +0200 |
| commit | 7cdefb927e928780cdbbb3a9b2ffe37716eebae1 (patch) | |
| tree | ae4a23f0a97c5a6cf8d08896cfc111c9bf6ceb1d /src/script | |
| parent | Merge pull request #6414 (diff) | |
| parent | Implement accurate memory accounting for mempool (diff) | |
| download | discoin-7cdefb927e928780cdbbb3a9b2ffe37716eebae1.tar.xz discoin-7cdefb927e928780cdbbb3a9b2ffe37716eebae1.zip | |
Merge pull request #6410
5098c47 Implement accurate memory accounting for mempool (Pieter Wuille)
Diffstat (limited to 'src/script')
| -rw-r--r-- | src/script/script.cpp | 5 | ||||
| -rw-r--r-- | src/script/script.h | 3 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/script/script.cpp b/src/script/script.cpp index fd3392473..b1d2ceeb9 100644 --- a/src/script/script.cpp +++ b/src/script/script.cpp @@ -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))); +} diff --git a/src/script/script.h b/src/script/script.h index e39ca57f4..aea34d05f 100644 --- a/src/script/script.h +++ b/src/script/script.h @@ -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 |