ci(miri): run oxc_allocator tests with Miri on Windows#22121
Merged
graphite-app[bot] merged 1 commit intoMay 14, 2026
Merged
Conversation
This was referenced May 5, 2026
Member
Author
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the existing Miri CI workflow to also run oxc_allocator tests under Miri on a GitHub-hosted Windows runner, targeting Windows-specific fixed-size allocator code paths.
Changes:
- Add a new
miri-windowsjob onwindows-latestthat runscargo +nightly miri testforoxc_allocator. - Reuse the existing
check-changescomposite action to decide whether to execute the Windows Miri steps based onoxc_allocatorchanges.
camc314
reviewed
May 5, 2026
c66882c to
d14a4f2
Compare
d14a4f2 to
b710538
Compare
28567af to
d3d2249
Compare
b710538 to
6fe6d15
Compare
camc314
approved these changes
May 14, 2026
camc314
left a comment
Contributor
There was a problem hiding this comment.
in future, we could consider making this a separate job on miri.yml (or perhaps use a matrix
Contributor
Merge activity
|
Run the tests for `oxc_allocator` under Miri on Windows on CI. Set to run on all PRs which touch `oxc_allocator`'s code, but not any other crates. This is preparation for Windows-specific changes to fixed-size allocators, which contain complex unsafe code.
d3d2249 to
66d77eb
Compare
6fe6d15 to
f5ed139
Compare
graphite-app Bot
pushed a commit
that referenced
this pull request
May 14, 2026
…22124) Fixes #19395 - OOM errors in Oxlint JS plugins on Windows. ### The problem Previously, on all platforms each fixed-size (raw transfer-enabled) allocator obtained a large chunk of memory from the `System` allocator (6 GiB in the case of Windows). This is fine on MacOS and most Linux distros, as they use overcommit allocation accounting, so these allocations consume only virtual memory (address space), not actual physical memory. The available address space is enormous (~128 TiB), so it's hard to exhaust it. Physical memory is only consumed when pages of the allocation are actually touched, which the vast majority never are. Windows behaves differently. Allocations obtained from `System` allocator immediately count towards the memory limit. So, on memory-constrained machines, allocating 6 GiB can immediately fail - OOM just from linting the first file. ### This PR [#22088](#22088), #22122, and #22123 introduced platform-specific code for handling allocation and deallocation of fixed-size `Arena`s, which are used in raw transfer/Oxlint JS plugins. This PR switches to a different allocation method on Windows for fixed-size `Arena`s. It switches to using [VirtualAlloc](https://learn.microsoft.com/en-us/windows/win32/api/memoryapi/nf-memoryapi-virtualalloc). This Windows-only API allows reserving address space and committing pages of that reservation as separate operations (similar to `mmap`). It works like this: - Fixed-size allocators now still reserve 6 GiB, but that only consumes address space, and does not count towards max memory limit. - Of that 6 GiB reservation, a 2 GiB "container", aligned on a 4 GiB boundary, will be used as the active part of the memory for storing the AST and other data. - Initially only the last 16 KiB of the container is committed (made into usable memory, with physical pages backing it). - If AST does not fit in the committed region, the region grows downwards, committing further pages to accomodate allocation requests, up to the maximum of 2 GiB. Essentially, this replicates something similar to Linux-style allocation, but on Windows. The only difference is that on Windows it's necessary to explicitly commit pages before touching them, whereas Linux/MacOS commit on demand automatically. ### Implementation details and testing This PR uses the battle-tested [windows-sys](https://crates.io/crates/windows-sys) crate for `VirtualAlloc` and `VirtualFree`. The allocation implementation is written from scratch, but while I was researching to validate that I'd not missed any edge cases, I discovered that it's almost identical to [wasmtime's implementation](https://github.com/bytecodealliance/wasmtime/blob/386a3280dee61f5c4120ce7cde621c1039e383d5/crates/wasmtime/src/runtime/vm/sys/windows/mmap.rs) which uses the same APIs. Comments in the code go over in some detail considerations of Rust's memory model and pointer provenance. As far as I can see, the implementation is fairly watertight. There are tests for the essential functionality and edge cases, and #22121 made these tests run under Miri on Windows. However, I don't have access to a Windows machine to fully test this by running Oxlint on a massive repo. I am hoping members of the community who do can put this through its paces a bit before we merge. ### What's missing In enormous projects, when linting with both JS plugins and `import` plugin, it's possible to end up with a huge number of ASTs in memory simultaneously. With each AST consuming 6 GiB of address space, it's possible to exhaust the entire 128 TiB usable address space, and get OOM on _virtual_ memory. At present we have a workaround to prevent too many fixed-size allocators existing concurrently, so avoiding OOM, but the workaround is a drag on performance. Future work will aim to address this.
Base automatically changed from
om/05-13-fix_allocator_fix_segfault_on_linux_musl_with_fixed-size_allocators
to
main
May 14, 2026 22:31
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.

Run the tests for
oxc_allocatorunder Miri on Windows on CI.Set to run on all PRs which touch
oxc_allocator's code, but not any other crates.This is preparation for Windows-specific changes to fixed-size allocators, which contain complex unsafe code.