Junk fill freed memory on dev builds to help find use after frees. #86818
+13
−0
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.
While investigating #86427, not all systems would crash. My desktops with Fedora 39 crash consistently but other systems like mingw windows build did not. This makes it hard for others to confirm the issue or investigate when they can't reproduce the issue.
Filling memory with junk on free helps give deterministic behavior. Its currently guarded by DEV_ENABLED where there are already lots of slower checks being done. There is nothing magic about the 0xab value I'm filling with. It was picked as I've used it before.
With junk filling, the mingw build mentioned above consistently crashes the same as my Fedora 39 systems.
Since it was helpful for confirming behavior looking into #86427, I figured make a PR for it. I could easily see something like this not being desired (and it fairly easy to do when needed).