Skip to content

Commit

Permalink
Merge #6233: fix: release unused memory in CNetMsgMaker::Make()
Browse files Browse the repository at this point in the history
c2c4b2b 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 c2c4b2b
  PastaPastaPasta:
    utACK c2c4b2b
  knst:
    utACK c2c4b2b

Tree-SHA512: 72a3728e316fb76ca135fbfff4f15b80c60b048d7e916d2f5dbcde4b64dce7177af80f8f24153636ccfab2f5d5c7d9edc5b3bdba121f64c8da03117a98fd7411
  • Loading branch information
PastaPastaPasta committed Aug 31, 2024
2 parents cddbc2a + c2c4b2b commit d16e953
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/netmessagemaker.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class CNetMsgMaker
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;
}

Expand Down

0 comments on commit d16e953

Please sign in to comment.