aboutsummaryrefslogtreecommitdiff
path: root/src/script
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2015-07-09 13:56:31 -0400
committerPieter Wuille <pieter.wuille@gmail.com>2015-07-10 10:49:31 -0400
commit5098c47b2430ded299c21620527ebd0544fe51e2 (patch)
tree5423630dea9653802744ed2bb997797fc1b6ca96 /src/script
parent943b322d5d292707e193f3a9d8e971881540be23 (diff)
Implement accurate memory accounting for mempool
Diffstat (limited to 'src/script')
-rw-r--r--src/script/script.cpp5
-rw-r--r--src/script/script.h3
2 files changed, 8 insertions, 0 deletions
diff --git a/src/script/script.cpp b/src/script/script.cpp
index fd33924732..b1d2ceeb9f 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 e39ca57f4f..aea34d05f4 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