Skip to content

Commit c3a6722

Browse files
committed
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.
1 parent c6594c0 commit c3a6722

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/net.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,7 @@ std::string strSubVersion;
121121

122122
size_t CSerializedNetMsg::GetMemoryUsage() const noexcept
123123
{
124-
// Don't count the dynamic memory used for the m_type string, by assuming it fits in the
125-
// "small string" optimization area (which stores data inside the object itself, up to some
126-
// size; 15 bytes in modern libstdc++).
127-
return sizeof(*this) + memusage::DynamicUsage(data);
124+
return sizeof(*this) + memusage::DynamicUsage(m_type) + memusage::DynamicUsage(data);
128125
}
129126

130127
void CConnman::AddAddrFetch(const std::string& strDest)

0 commit comments

Comments
 (0)