mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-12 11:19:08 -05:00
streams: add DataStream::GetMemoryUsage
This commit is contained in:
parent
c3a6722f34
commit
047b5e2af1
2 changed files with 9 additions and 0 deletions
|
@ -2,6 +2,7 @@
|
||||||
// Distributed under the MIT software license, see the accompanying
|
// Distributed under the MIT software license, see the accompanying
|
||||||
// file COPYING or https://opensource.org/license/mit/.
|
// file COPYING or https://opensource.org/license/mit/.
|
||||||
|
|
||||||
|
#include <memusage.h>
|
||||||
#include <span.h>
|
#include <span.h>
|
||||||
#include <streams.h>
|
#include <streams.h>
|
||||||
#include <util/fs_helpers.h>
|
#include <util/fs_helpers.h>
|
||||||
|
@ -110,3 +111,8 @@ bool AutoFile::Truncate(unsigned size)
|
||||||
{
|
{
|
||||||
return ::TruncateFile(m_file, 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));
|
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>
|
template <typename IStream>
|
||||||
|
|
Loading…
Add table
Reference in a new issue