You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
perf(fspy): use sparse Windows shared memory (#524)
## Motivation
Avoid reserving disk space for the full Windows mapping while keeping record writes memory-mapped.
## Changes
- Maps a sparse, delete-on-close temporary file through a named Windows section.
- Uses a size-independent section name and opens another view using only the identifier.
- Maps the complete section and derives its length from the mapped view.
- Fails creation when the temporary volume does not support sparse files.
- Keeps existing views valid after the owner closes its file and view.
- Replaces linker inputs previously supplied by `shared_memory` with direct `windows-sys` imports.
- Covers cross-process access, cleanup, sparse allocation, and changed environments.
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,6 @@
1
1
# Changelog
2
2
3
+
-**Improved** Windows file-access tracking now uses sparse temporary backing files where supported, avoiding upfront allocation of the full backing file on disk ([#524](https://github.com/voidzero-dev/vite-task/pull/524)).
3
4
-**Fixed** Automatic file-access tracking on Linux now works in containers and Kubernetes runners with limited `/dev/shm` space ([#353](https://github.com/voidzero-dev/vite-task/issues/353), [#523](https://github.com/voidzero-dev/vite-task/pull/523)).
4
5
-**Fixed** Windows automatic input tracking now records executable image reads when process creation performs the lookup inside `NtCreateUserProcess` ([#518](https://github.com/voidzero-dev/vite-task/pull/518)).
5
6
-**Fixed** Failures while waiting for a started task process to exit no longer incorrectly say the process failed to spawn ([#515](https://github.com/voidzero-dev/vite-task/pull/515)).
Copy file name to clipboardExpand all lines: crates/fspy_shm/README.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,5 +34,6 @@ The channel hides that difference with its lock file. [`ChannelConf::sender`](..
34
34
Each platform keeps its implementation rationale beside its source:
35
35
36
36
-[Linux: `memfd` with a descriptor broker](src/linux/README.md)
37
+
-[Windows: sparse file-backed named mapping](src/windows/README.md)
37
38
38
-
At this point in the stack, Windows and macOS still delegate mapping creation and opening to the [`shared_memory`](https://crates.io/crates/shared_memory) crate.
39
+
At this point in the stack, macOS still delegates mapping creation and opening to the [`shared_memory`](https://crates.io/crates/shared_memory) crate.
The Windows backend maps a sparse temporary file and gives the mapping a Windows section name. Another process opens the same section using only that name. Creating the mapping does not reserve its full size in system commit or disk space.
| Paging-file-backed section | Rejected because the section's full size is charged against system commit. |
10
+
| Reserved section with incremental `VirtualAlloc(MEM_COMMIT)`| Rejected because writers would need to coordinate when committing more pages. |
11
+
| Sparse temporary file with a named section | Selected. Disk blocks are allocated only for written ranges, and another process can open the mapping using the section name. |
12
+
13
+
`FILE_ATTRIBUTE_TEMPORARY` tells Windows to keep file data in memory when possible, but Windows may still write dirty pages to disk under memory pressure. Creation fails if the temporary volume does not support sparse files.
14
+
15
+
## Why not `shared_memory`
16
+
17
+
`shared_memory` creates and extends a regular file before fspy can mark it sparse. It therefore cannot ensure that untouched ranges use no disk blocks.
18
+
19
+
`shared_memory` also uses the file path to identify the mapping. Fspy uses the section name, so another process does not need the creator's temporary-file path.
20
+
21
+
## Lifetime semantics
22
+
23
+
Dropping the owner unmaps its view and closes the delete-on-close backing file. Existing views keep the section alive. The section name may remain openable during that period. `ChannelConf::sender` checks the receiver's lock file first to prevent new senders after the receiver has shut down.
0 commit comments