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.
This commit is contained in:
laanwj 2024-11-04 18:26:06 +01:00
parent c6594c0b14
commit c3a6722f34

View file

@ -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)