Repository navigation
Merged
Conversation
…that allocates nothing reports allocations=0 (#2722) rt_store_args sets PWD from the real directory at startup (#1082). It went through with_str_from_cstr and win_setenv, which allocate a 24-byte str and the UTF-16 name and value (8 and 48 bytes for a 23-character cwd: the trace on win10 showed exactly those three before main), so every Windows program counted three heap allocations the other hosts do not make: da_d119_literal_no_heap saw allocations=6 for 3, and da_no_allocation_reports 3 for 0. The startup now converts the cwd into a stack buffer, as the realpath beside it does, and calls SetEnvironmentVariableW directly. Tests: test/debug_alloc/da_d119_literal_no_heap.w and da_no_allocation_reports.w, run on Windows once the debug-alloc lane runs there (#807).
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.
rt_store_args sets PWD from the real directory at startup (#1082). It
went through with_str_from_cstr and win_setenv, which allocate a 24-byte
str and the UTF-16 name and value (8 and 48 bytes for a 23-character
cwd: the trace on win10 showed exactly those three before main), so every
Windows program counted three heap allocations the other hosts do not
make: da_d119_literal_no_heap saw allocations=6 for 3, and
da_no_allocation_reports 3 for 0. The startup now converts the cwd into a
stack buffer, as the realpath beside it does, and calls
SetEnvironmentVariableW directly.
Tests: test/debug_alloc/da_d119_literal_no_heap.w and
da_no_allocation_reports.w, run on Windows once the debug-alloc lane runs
there (#807).
Closes #2722