Repository navigation
fix: windows memory leak - #131
Merged
Merged
Conversation
arun11299
approved these changes
Mar 27, 2026
fanquake
added a commit
to bitcoin/bitcoin
that referenced
this pull request
Oct 22, 2026
cf30d0a subprocess: fix command line memory leak on Windows (stickies-v) Pull request description: `Popen::execute_process()` copied the command line into a buffer from `new[]`, but did not delete it. This leaked memory each time a process started on Windows. `CreateProcessA` [needs](https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-createprocessa#:~:text=characters%2E-,The,violation) a writable command line buffer. Since C++17, `std::string::data()` supplies one, so give the `std::string` buffer directly and remove the copy. This only affects Windows. It is only reachable if `-signer=<cmd>` is set, through authenticated RPC or the GUI. Each call leaks only the startup-defined `<cmd>`, and the rate is limited by process spawn time, so the impact is limited. _edit: this was fixed upstream in arun11299/cpp-subprocess#131, but since this codebase is C++20 it seems better to avoid the copy (and the const cast). A direct backport isn't possible anyway, since #35704 switched us to CreateProcessA._ ACKs for top commit: jpk68: ACK cf30d0a hebasto: re-ACK cf30d0a. winterrdog: reACK cf30d0a Tree-SHA512: 873a5b69e4094dfc1cba0f822af1e431f7d6e29f2fac58e0712ffa060296022db0cbff55ab6f7a4416168e4958bcaa1567ad568f2a3a662e3cb4603bbb786816
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.