mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-19 01:42:58 +01:00
streams: add DataStream::GetMemoryUsage
This commit is contained in:
parent
c3a6722f34
commit
047b5e2af1
@ -2,6 +2,7 @@
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or https://opensource.org/license/mit/.
|
||||
|
||||
#include <memusage.h>
|
||||
#include <span.h>
|
||||
#include <streams.h>
|
||||
#include <util/fs_helpers.h>
|
||||
@ -110,3 +111,8 @@ bool AutoFile::Truncate(unsigned size)
|
||||
{
|
||||
return ::TruncateFile(m_file, size);
|
||||
}
|
||||
|
||||
size_t DataStream::GetMemoryUsage() const noexcept
|
||||
{
|
||||
return sizeof(*this) + memusage::DynamicUsage(vch);
|
||||
}
|
||||
|
@ -277,6 +277,9 @@ public:
|
||||
{
|
||||
util::Xor(MakeWritableByteSpan(*this), MakeByteSpan(key));
|
||||
}
|
||||
|
||||
/** Compute total memory usage of this object (own memory + any dynamic memory). */
|
||||
size_t GetMemoryUsage() const noexcept;
|
||||
};
|
||||
|
||||
template <typename IStream>
|
||||
|
Loading…
Reference in New Issue
Block a user