Repository navigation
Return the pooled reparse buffer on every path in TryGetReparseDataBuffer (#240) - #246
Merged
Merged
Conversation
ForNeVeR
self-requested a review
October 19, 2026 11:03
ForNeVeR
force-pushed
the
fix-240-reparse-buffer
branch
from
October 24, 2026 20:56
b40df4d to
8ae7e34
Compare
…ready see the reparse point flag
ForNeVeR
force-pushed
the
fix-240-reparse-buffer
branch
2 times, most recently
from
October 24, 2026 21:45
6432d3e to
75b2ffa
Compare
…vior w.r.t. the exceptions Only return null when the target is not found, not in any other cases.
ForNeVeR
force-pushed
the
fix-240-reparse-buffer
branch
from
October 24, 2026 21:51
75b2ffa to
e33aeab
Compare
ForNeVeR
approved these changes
Oct 24, 2026
ForNeVeR
left a comment
Owner
There was a problem hiding this comment.
Thanks! I did some more digging and managed to reduce the allocations even more, but I'll mention your contribution in the release notes.
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.
Closes #240
TryGetReparseDataBufferrents a 16 KiB buffer fromArrayPool<byte>.Sharedbut only returned it whenDeviceIoControlsucceeded. For almost every directory the call fails because it is not a reparse point, the method returned early, and the buffer was dropped. So everyReadKind()on a directory allocated a new 16 KiB array.The rent is now inside a
try/finallyso the buffer always goes back to the pool.DeviceIoControlhas finished writing by then, so reusing it is safe.I added a test, Windows only, that calls
ReadKind()on a directory and checks it allocates less than 1 KiB per call. Without the fix it fails with 16,576 bytes per call. With the fix it passes, and the wholeTruePath.Testsrun on net8.0 is 471 passed, 0 failed on Windows 11. To run it locally I had to bumpglobal.jsonto the SDK I have installed; that change is not in the PR. There is also a changelog entry under Unreleased.I did not do the other idea from the issue (skip the reparse query when the
ReparsePointattribute is not set). I can do it as a follow up if you prefer that.