From c3a6722f34a575834b282894d441d7bf802bd467 Mon Sep 17 00:00:00 2001 From: laanwj <126646+laanwj@users.noreply.github.com> Date: Mon, 4 Nov 2024 18:26:06 +0100 Subject: [PATCH] net: Use DynamicUsage(m_type) in CSerializedNetMsg::GetMemoryUsage Now that memusage correctly computes the dynamic size of a string, there is no need for special handling here. --- src/net.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/net.cpp b/src/net.cpp index d76b39f75d5..3e936b5f3de 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -121,10 +121,7 @@ std::string strSubVersion; size_t CSerializedNetMsg::GetMemoryUsage() const noexcept { - // Don't count the dynamic memory used for the m_type string, by assuming it fits in the - // "small string" optimization area (which stores data inside the object itself, up to some - // size; 15 bytes in modern libstdc++). - return sizeof(*this) + memusage::DynamicUsage(data); + return sizeof(*this) + memusage::DynamicUsage(m_type) + memusage::DynamicUsage(data); } void CConnman::AddAddrFetch(const std::string& strDest)