Merge #6233: fix: release unused memory in CNetMsgMaker::Make()

c2c4b2b794 fix: release unused memory in `CNetMsgMaker::Make()` (UdjinM6)

Pull request description:

  ## Issue being fixed or feature implemented
  We reserve capacity for large messages in `CNetMsgMaker::Make()` but most messages are small yet we never release unused memory here. Discovered while debugging 28165 backport issues.

  ## What was done?

  ## How Has This Been Tested?

  ## Breaking Changes
  n/a

  ## Checklist:
  - [x] I have performed a self-review of my own code
  - [ ] I have commented my code, particularly in hard-to-understand areas
  - [ ] I have added or updated relevant unit/integration/functional/e2e tests
  - [ ] I have made corresponding changes to the documentation
  - [ ] I have assigned this pull request to a milestone

ACKs for top commit:
  kwvg:
    ACK c2c4b2b794
  PastaPastaPasta:
    utACK c2c4b2b794
  knst:
    utACK c2c4b2b794

Tree-SHA512: 72a3728e316fb76ca135fbfff4f15b80c60b048d7e916d2f5dbcde4b64dce7177af80f8f24153636ccfab2f5d5c7d9edc5b3bdba121f64c8da03117a98fd7411
This commit is contained in:
pasta 2024-08-30 16:28:24 -05:00
commit d16e95352c
No known key found for this signature in database
GPG Key ID: 52527BEDABE87984

View File

@ -21,6 +21,7 @@ public:
msg.m_type = std::move(msg_type);
msg.data.reserve(4 * 1024);
CVectorWriter{ SER_NETWORK, nFlags | nVersion, msg.data, 0, std::forward<Args>(args)... };
msg.data.shrink_to_fit();
return msg;
}